I have two textboxes and when TAB is pressed from one textbox it goes to another place instead of to the next textbox.
My code is:
$(function () {
$("input[id$=txt1]").bind('keydown',
function (e) {
if (e.which == 9) {
// alert("hello");
$("input[id$=txt2]").focus();
}
}
);
});
When I press tab for txt1 it should go to txt2 but it doesn’t.
Any help?
Just use preventDefault and it will work
BTW, its much better to use direct selectors with ids (#txt2 instead of input[id$=txt2]).