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 });