I want to capture the TAB keypress, cancel the default action and call my own javascript function.
I want to capture the TAB keypress, cancel the default action and call my own javascript function.
You can capture an event tab using this JQuery API.
$( "#yourInputTextId" ).keydown(function(evt) {
if(evt.key === "Tab")
//call your function
});
This worked for me:
$("[id*=txtName]").on('keydown', function(e) { var keyCode = e.keyCode || e.which; if (keyCode == 9) { e.preventDefault(); alert('Tab Pressed'); } });