hi all
I Want get key value on keyPress with jQuery In textbox
hi all
I Want get key value on keyPress with jQuery In textbox
Use the keypress event as described here; there's an example on that page showing how to get the key code:
$('#target').keypress(function(event) {
if (event.keyCode == '13') {
event.preventDefault();
}
xTriggered++;
var msg = 'Handler for .keypress() called ' + xTriggered + ' time(s).';
$.print(msg, 'html');
$.print(event);
});
You want the event.keyCode part.
This page may also be useful, it describes some "gotchas" around cross-browser keypress handling. jQuery may smooth some of those out for you, but good to be aware of them.
$('#textbox').keypress(function(e) {
var code = e.keyCode || e.which;
});