CSS-Tricks is brought to you in part by Media Temple, the web hosting that we both use and recommend.
Please explain how the following jquery snippet works
Jquery docs says this code will alter the first list item only, as it contains exactly one “strong” tag
I am confused about the “this” part in the following line of code. I believe “this” returns “li”elements and I can not correlate it with strong
return $(‘strong’, this).length == 1;
This reply has been reported for inappropriate content.
$(element, context)<br />
So $('strong', this) is equivalent to $(this).find('strong')
The snippet you’ve provided will return every <li> that contains a <strong> element.
You must be logged in to reply to this topic.
Search for Stuff
Browse the Archives
Get the Newsletter
... or get the RSS feed