Solution 1 :

Try $('a#songid')[0].click() instead.

So, get the first element, and call the click method instead of triggering the event.

Problem :

 <a href="javascript:firescript('1','2','3');" id="songid" class="track__number">

This is the anchor tag.
Now to automate click on this anchor tag to execute the href –> javascript fn using jquery

     $(document).ready(function () {

This doesn’t seem to execute the JavaScript function. Please help me regarding this.

NOTE: The function is an AJAX query so i wouldn’t want to redirect to some other page.


Comment posted by user13539671

Thank you so much, it works.

Comment posted by Lennart Steinke

Glad this works for you. Would be great if you could accept the answer 🙂