jquery - Execute javascript code in a href tags -


i have page several (100+) entries this:

<a href="javascript:removefromcart(12302, 2);" class="remove">remove</a> 

now looking jquery snippet can run in console , helps me "click" "links" , execute javascript function removecart() respective parameters.

this not work:

$("a[href^='javascript']:contains('remove')").click() 

any ideas?

you can’t use .click() here, because there no event binding anchor. need manually execute contents of href attribute, , can easilly done using eval():

$('.remove').each(function() {     eval(this.href); }); 

Comments