$("#parentOfTextbox").on('keydown', '#textbox', function(e) { var keyCode = e.keyCode || e.which; if (keyCode == 9) { e.preventDefault(); // call custom function here } });