Monday, July 23, 2012

Asp.Net jQuery Textbox keypress event Handler

The keypress event of a TextBox can be handled by tracking the keypress event in jQuery as follows.

Syntax
$("#yourtextbox").keypress(function() {
… 
});

Example

//
// Textbox Event Handler - keypress Event
$('#txtEventHandler').keypress(function(event) {
   alert('Keypress event fired for the key: ' + event.which);
   alert('Textbox Value: ' + $(this).val());
});

<asp:TextBox id="txtEventHandler" runat="server"></asp:TextBox></asp>

Search Flipkart Products:
Flipkart.com

No comments: