re-firing a click event on a link with jQuery

前端 未结 2 1947
广开言路
广开言路 2020-12-07 05:08

i\'ve got a page (asp.net) where I trap the click event of a link. i then do some dirty checking and present a dialog to the user,

$(function() {
    var c         


        
相关标签:
2条回答
  • 2020-12-07 05:37

    you can use the trigger function, Change:

    $(clickedLink).click();
    

    to

    $(clickedLink).trigger("click");
    

    A better way would be to separate your click functionality out into a separate function and call this, however the above will work.

    0 讨论(0)
  • 2020-12-07 05:41

    .click() only fires the event handlers for onclick, it doesn't actually make the default action of following the link happen. Probably the quickest method is just to do that manually:

    window.location= clickedLink.href;
    

    PS. “lose”

    0 讨论(0)
提交回复
热议问题