I have been playing around with a search control and i have noticed that when you try and press enter from within the textbox it submits the form but doesnt click the search button (like i want it to).
My markup is:
<div>
<span>Search</span>
<asp:TextBox ID="txtSearch" runat="server" Width="170"
onkeydown="if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {$('#<%=lkbSearch.ClientID %>').click();return false;} else return true; ">
</asp:TextBox>
</div>
<asp:LinkButton ID="lkbSearch" runat="server" CssClass="searchButton">
<asp:Image ID="imgSearch" runat="server" ImageUrl="~/Images/Master/button_go.gif" />
</asp:LinkButton>
i added the onkeydown event to the textboxes, and it runs, but when i try to use JQuery to call the Click() function from the button it does nothing.
How can i make it so when enter is pressed in the textbox it "clicks" the button?