How can i use trigger() in jquery to emulate onclick attribute of a anchor tag:
<a id="anc" href="#" onclick="someFunction()"> some text </a>
here if i use
$("anc").trigger('click');
its not working
you need to correctly reference the id "anc" in the jQuery selector with a #:
$("#anc").trigger('click');
you need to use # for id
$("#anc").click(function() {
return false // this will kill the default behaviour and your page won't jump
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With