html - jquery trigger click event for 'a' tag -


i trying trigger click event anchor tag inside 'li'. when click on 'li', want trigger tag inside 'li'. html , jquery given below. below jquery showing error.

"too recursion .."

<li><a href="link">link text</a></li>   $(document).ready(function(){  $("#menu-top li").click(function(){   $(this).children('a').click();  }); }); 

please me. thanks

use trigger event!

<li><a href="link">link text</a></li>  $(document).ready(function(){  $("#menu-top li").click(function(){   $(this).children('a').trigger('click');  }); }); 

any event handlers attached .on() or 1 of shortcut methods triggered when corresponding event occurs. can fired manually, however, .trigger() method. call .trigger() executes handlers in same order if event triggered naturally user

jquery trigger event


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -