paul bennett

CSS2 and CSS3 selectors in jQuery

Posted on: April 29, 2008

Along with dom traversal (ala CSS2), you can also use CSS2 and CSS3 selectors in jQuery. For example:

lb = $('a[rel="lightbox"]');

will get you all the anchor elements in the dom which have the rel="lightbox" attribute. This, however:

lb = $('a[rel*="light"]');

will get you all the anchor elements in the dom which have the substring “light” in their rel attribute.

Advertisements
Tags: ,

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

Archives

%d bloggers like this: