How to call backward link of another element in jQuery to another event?

Hi This is a kind of peculiar requirement.

I use asp.net and jQuery together

I have a link button as follows

<asp:LinkButton ID="displayBtn" runat="server" OnClick="displayBtn_Click" Text="Display 
Content"></asp:LinkButton>

I will hide this link using

style="dipsly:none;" 

and you want to trigger the feedback caused by clicking the asp link button using some other html element, say a div.

<div id="invokeTest"> Click here </div>

I tried to use

$('#invokeTest').click(function(){
  $('#<%=displayBtn.ClientID%>').click();
});

Any idea how this can be done?

+3
source share
2 answers

Instead, LinkButtontry using Button:

<asp:Button ID="displayBtn" 
            runat="server" 
            OnClick="displayBtn_Click" 
            Text="Display Content" 
/>
+2
source

Try

$('#<%=displayBtn.ClientID%>').trigger("click");

See . trigger ()

+2
source

Source: https://habr.com/ru/post/1741417/


All Articles