The keydown event of the TextBox can
be handled by tracking the keydown event in jQuery as follows.
Syntax
$("#yourtextbox").keydown(function() {
…
});
Syntax
$("#yourtextbox").keydown(function() {
…
});
Example
//
// Textbox Event Handler - keydown Event
$('#txtEventHandler').keydown(function(event) {
alert('Keydown
event fired for the key: ' + event.which);
alert('Textbox
Value: ' + $(this).val());
});
<asp:TextBox id="txtEventHandler" runat="server"></asp:TextBox></asp>
<asp:TextBox id="txtEventHandler" runat="server"></asp:TextBox></asp>
Notice that the keydown
event delays fetching the value of textbox by the latest 1 character, the keyup
event gives the exact value from the textbox.
No comments:
Post a Comment