What's the difference between the space and > selectors? And possibly related, how can I look for something that's the direct child of something else, and not lower down the descendant line?
For:
<ul>
<li>Item 1</li>
<li>Item 2
<ul>
<li>Item 2.1</li>
<li>Item 2.2</li>
</ul>
</li>
<li>Item 3</li>
</ul>
For example
$("ul > li").addClass("blah");
adds class "blah" to 1 2 and 3 whereas:
$("ul li").addClass("blah");
add class "blah" to every list element.
I'm not sure what you're referring to with < and ? operators.
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