Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Combining multiple css3 selectors

Combining multiple css3 selectors

Problem

I know it's possible to combine some CSS3 selectors in jQuery but is it possible to combine all variations?

For example, I have a dynamically generated page that outputs an id with a unique identifier on the end, like videoPlayer-123 and I want to select all instances of that id who direct sibling is a paragraph tag. See example here:

$('p+div[id^=videoPlayer]').css('width','100%');

Does that work? Or is there a better way to do this?

Here is an example of what the HTML looks like:

Test video 1234

Problem courtesy of: HjalmarCarlson

Solution

That's perfectly valid and probably the best way to do it.

Solution courtesy of: Niet the Dark Absol

Discussion

View additional discussion.



This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here

Share the post

Combining multiple css3 selectors

×

Subscribe to Css3 Recipes - The Solution To All Your Style Problems

Get updates delivered right to your inbox!

Thank you for your subscription

×