Reputation: 868
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:
<p>
<span>
<h2>Test video 1234</h2>
</span>
</p>
<div id='videoPlayer_1234'>
<div id='videoPlayer_1234_container'>
<video controls="controls"><source src="test.mp4"/></video>
</div>
</div>
Upvotes: 1
Views: 121
Reputation: 324620
That's perfectly valid and probably the best way to do it.
Upvotes: 1