Listener on ENTER button
-
I am trying to add an Event Procedure to a text field such that pressing the ENTER keyboard button activates the same procedure as clicking the submit button on the form. Apparently asp.net's textbox control does not have an ability to generate those kind of event. Or is there any way to do this? Thank you
-
I am trying to add an Event Procedure to a text field such that pressing the ENTER keyboard button activates the same procedure as clicking the submit button on the form. Apparently asp.net's textbox control does not have an ability to generate those kind of event. Or is there any way to do this? Thank you
You can write a javascript function that gets called on the client-side onkeydown (not onkeypress) event. Check that if the character pressed is 13 (ENTER) then submit your form. Hope that helps. "Democracy is two wolves and a sheep voting on what to have for dinner" - Ross Edbert Sydney, Australia