jQuery Find-multiselect shorthand

This is as much for my reference as anything else, so it will be rather brief – but it is something I forget regularly.

The jQuery selector: $(“.three”, “.two”, “.one”)

Selects elements with the class ‘three’ inside elements with the class ‘two’ inside elements with the class ‘one’. Equivalent to $(“.one .two .three”) and $(“.one”).find(“.two”).find(“.three”). Not so useful in this example but good for when you are using jQuery variables (i.e. var vOne = $(“.one”)) instead of selector strings.

About Simeon Cheeseman

I enjoy a wide variety of computer and board games, have a BSc in Computer Science and have played percussion for 18 years.

Posted on July 19, 2011, in jQuery. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: