I'm aware by going over the jQuery traversal documentation that there isn't a jQuery function that will do what I'm looking for so I'm asking what combination (if there is one) will do the trick.
If we have 1 <span>
for every <textarea>
on a page, and without having to get creative by adding id
's or class
es or data-
attributes etc. would like to get the closest previous <span>
to the <textarea>
that is the target
of the current keydown
event.
What combination of jQuery traversal functions can we use to solve this problem? I've researched and tried everything I know to.
Check out this Fiddle to better visualize this problem.
` tag which the answerer removed, it no longer works, which according to the op was the original point. see here: http://jsfiddle.net/r3wt/aQ83s/16/ – r3wt Jul 05 '14 at 01:04