0

i have a problem with a mobile menu, i want an element to get triggered when i click on the menu links my code works perfectly when tested on desktop browsers but not in mobile browser

this is my code :

jQuery(document).ready(function(){

   jQuery(".menu-item > a").on("click touchstart", function(){
       jQuery(".hamburger-box").click();
   });


});
user9666156
  • 31
  • 2
  • 7
  • that selector is naaaasty! – Pete Dec 10 '19 at 12:22
  • Does this answer your question? [How to trigger a click on a link using jQuery](https://stackoverflow.com/questions/5811122/how-to-trigger-a-click-on-a-link-using-jquery) – Pete Dec 10 '19 at 12:24

2 Answers2

0

I assume your jquery selector right;you can use Jquery("selector").trigger("click");

  • jQuery(".menu-item > a").on("click touchstart", function(){ console.log(jQuery(".hamburger-box")) }); log to console and after look do you find right elements – onursahin07 Dec 10 '19 at 12:58
0

Try by adding this,

jQuery('.hamburger-box').trigger('touchstart');