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');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.