So I came across the Next Sibling Selector on the jQuery docs today:
$("label + input")
And was wondering - is there an inverse of this selector? i.e. select the Previous Sibling?
I could use:
$("label + input").prev()
For example in this fiddle, I get all labels in which a label is followed by an input, which is what I want, but is this the only way to do it?
You can use array provided by sibling()
Check this out:
http://api.jquery.com/category/traversing/tree-traversal/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With