I have the following HTML structure:
<div><a href="link1">blah</a></div>
<div><a href="link2">blah</a></div>
<div><a href="link3.swf">blah</a></div>
<div><a href="link4">blah</a></div>
<div><a href="link5.swf">blah</a></div>
<div><a href="link6.swf">blah</a></div>
Using jQuery I want to retrieve the links that contain the .swf
extension and add a class to their parent div
element. Here is my code, which is not working:
$('a[href:contains(".swf")]').parent().addClass=('filmtrigger')
Can you help me fix this?
$('a[href$="swf"]').parent().addClass('filmtrigger');
http://docs.jquery.com/Selectors
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With