jquery trigger a click event tag

My solution

<a id="logoutClick" href="${contextPath}/logout" ><i class="fa fa fa-sign-out"></i>退出</a>
$("#logoutClick")[0].click();
完美解决

$("#logoutClick")[0].click();

Reference
Today, I want to trigger a click event tag to automatic, but the events bound to a label, namely $ ( "# id"). Click (), but nothing happens, then checked, the original can not click event directly bound to a label must be tied to the elements within the tag.
E.g:

<a href="xxxxxxxxx" class="curr_li"><li id="bbbb">公式管理</li></a>

To automatically triggered if, $ ( "# bbbb"). Trigger ( "click")

Author: chancewang001
Source: CSDN
Original: https://blog.csdn.net/chancewang001/article/details/44963571
Copyright: This article is a blogger original article, reproduced, please attach Bowen link!

Published 49 original articles · won praise 5 · views 60000 +

Guess you like

Origin blog.csdn.net/wangwenpeng0529/article/details/86489583