Reputation: 3
I have an anchor tag with an onlick attribute containing some javascript code. I need to get this javascript executed using jquery or javascript. I have tried to call the click event on the anchor tag element but nothing happens. Clicking the anchor tag manually on the site works just fine but I cannot get it to work thru jquery.
/Måns
Upvotes: 0
Views: 1137
Reputation: 6655
Without example code I don't see any reason why something like this wouldn't work:
$('#some-link').click();
A possibly unsafe alternative would be...
var oc = $('#some-link').attr('onclick');
eval(oc);
Upvotes: 4