Skip to content Skip to sidebar Skip to footer
Reading Time: < 1 minute

Sometimes jquery trigger click event not working properly.That is not the browser issue.There is not jquery conflicting or javascript errors.If you already added jQuery.noConflict(), not working trigger click event.The main issue is the .click() function call is calling the browser’s built-in ‘click’ function,not the jquery’s.In other words, you can only trigger a click that jQuery has created.

Here is the basic script.

jQuery.noConflict();
jQuery(document).ready(function() {
    jQuery('.menuItem a').trigger('click');
});

 

Solutions….

So we’ll see how to fix this simple issue.

jQuery.noConflict();
jQuery(document).ready(function() {
    jQuery('.menuItem a')[0].click();//[0] gets the first (DOM) element.
});

Note:- [0] gets the first (DOM) element.