Monday, July 23, 2012

Asp.Net jQuery Textbox keyup event Handler


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

Syntax
$("#yourtextbox").keyup(function() {

});

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

<asp:TextBox id="txtEventHandler" runat="server"></asp:TextBox></asp>
Notice that the keyup event gives the exact value from the textbox, the keypress and keydown events will delay fetching the value of textbox by the latest 1 character.

Search Flipkart Products:
Flipkart.com

No comments: