re-firing a click event on a link with jQuery

自闭症网瘾萝莉.ら 提交于 2019-11-28 02:13:27

.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”

Alex S

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!