Grow your CSS skills. Land your dream job.

Filter example in JQuery docs

  • # June 5, 2013 at 1:57 pm

    Please explain how the following jquery snippet works

    http://pastebin.com/xVWsjj8u

    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;

    # June 5, 2013 at 3:33 pm

    $(element, context)

    So `$(‘strong’, this)` is equivalent to `$(this).find(‘strong’)`

    The snippet you’ve provided will return every `

  • ` that contains a `` element.
# June 5, 2013 at 8:13 pm

nice @jamy_za
Thank you

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".