- I have a text box which is an ajax auto complete,so when i select a record i save an id into a hidden variable.
- And there is a keydown event on that text box, if key down i delete the hidden variable value. because i don't want the user to enter any thing after he selects from the autocomplete.
- Now even when i press the tab button the hidden variable is cleared.
- Is there a way to avoid only Tab press event.?
Answer :
- When the tab is pressed you have to read if the keydown was from the Tab button, if so you can avoid it..
$("body").on('keydown', '#textboxId', function(e) {
var keyCode = e.keyCode || e.which;
if (keyCode == 9) {
e.preventDefault();
//IF Tab Pressed You Can Do Anything Here
} else{ //If Its Not Tab, You Can Do It Here }
});
No comments:
Post a Comment