/ Published in: jQuery
                    
                                        
This is a pretty standard jQuery method to listen for the enter key and simply "click" the button.  However, if you are using a LinkButton this code will not work.  The reason for this is that a LinkButton is rendered to the browser as an Anchor tag with a href property that contains a javascript action to trigger the postback.  Click does nothing on the button as there is nothing for it to complete.
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
$("#<%=txtPassword.ClientID %>").keydown(function(event) {
if (event.keyCode == 13) {
eval($("#<%=btnLogin.ClientID %>").attr('href'));
}
});
URL: http://www.mitchelsellers.com/blogs/2012/06/21/jquery-and-clicking-an-aspnet-linkbutton.aspx
Comments
 Subscribe to comments
                    Subscribe to comments
                
                