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
Comments
Post a Comment