Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have done shortcut key for button.

code is: [ 37 is left arrow ]
..........

XML
if (event.keyCode == 37) {

                document.getElementById('<%= Button1.ClientID %>').click();
            }



XML
i want dropdownlist shortcut key in asp.net javascript.
  if (event.keyCode == 13) { document.getElementById("<%=ddlIHNO.ClientID%>").value;
}
13 - enter key. this event is not fired.
Posted

1 solution

Try this , this works on jQuery

HTML
<script type="text/javascript"></script>

JavaScript
$(window).keydown(function(event){
        if(event.keyCode == 13) {
          event.preventDefault();
          //yourcode here.
          return false;
        }
      });

HTML
</script>


here 13 is enter press key code. you can found your own.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900