Using jQuery, find links containing a specific string and add a class
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 get the links containing the extension .swfand add the class to my parent element div. Here is my code that does not work:
$('a[href:contains(".swf")]').parent().addClass=('filmtrigger')
Can you help me fix this?
+5