jquery click doesn’t work on hyperlink

See click():

Triggers the click event of each
matched element.

Causes all of the functions that have
been bound to that click event to be
executed.

The important thing to note is that it does not duplicate clicking the link. It only triggers associated events. If you want to change location:

var link = $("#link_0");
link.click();
window.location.href = link.attr("href");

but even that is only an approximation as it doesn’t cater for handlers stopping event propagation.

Leave a Comment