如何在<a> is clicked?

时间:2016-05-27 08:09:17

标签: javascript jquery html asp.net html5

How can I simulate a click on the LinkButton so that CodeBehind will be read once an href is being clicked?

<asp:LinkButton ID="LinkButton_Home" runat="server" CausesValidation="False" OnClick="LinkButton_Home_Click">Home</asp:LinkButton></li>

<a href="#">Home</a>

1 个答案:

答案 0 :(得分:0)

您可以使用click

触发jquery事件
$(document).ready(function(){
    $('a').click(function(){
         $('#'+'<%=LinkButton_Home.ClientID%>').trigger('click');
    });
});

别忘了包含需要的jquery库。