Reputation: 7271
Apologies if this is a stupid question but it is quite hard to find using a search engine, but what does the '>' operator mean when used as a selector?
E.g.
$('div.form-input > label')....
Upvotes: 1
Views: 184
Reputation: 1646
It's parent > child - select all elements matching the second selector that are children of elements matching the first selector. For example:
div.myclass > p.yourclass
will select all p's of yourclass that are inside a div of myclass.
Upvotes: 5
Reputation: 6567
jQuery('parent > child')
Description: Selects all direct child elements specified by "child" of elements specified by "parent".
http://api.jquery.com/child-selector/
Upvotes: 4
Reputation: 33661
It selects the child of a div with class "form-input" that is a label. You can read more about child selector here http://api.jquery.com/child-selector/
Upvotes: 3
Reputation: 3843
div.form-input > label
selector will match the direct label
descendant of the div.form-input
Upvotes: 1
Reputation: 299048
The same as in CSS, a label directly inside a div with class form-input
$('div.form-input label') // label can be anywhere inside the div
$('div.form-input > label') // label must be directly inside the div (at top level)
Upvotes: 5