I have several text fields in my form, and I want the user to enter data in one text field and press enter so that the cursor moves to another text field that is next to the current text field. I visited some questions, but did not find them useful.
$("#username").keypress(function (event) { alert("inside function"); if(event.keyCode == 13) { textboxes = $("input.username"); debugger; currentBoxNumber = textboxes.index(this); if (textboxes[currentBoxNumber + 1] != null) { nextBox = textboxes[currentBoxNumber + 1]; nextBox.focus(); nextBox.select(); event.preventDefault(); return false; } } });
this is my code that I tried another thing, when the data entered in the last text field, then the form will be sent by clicking on the button that is not pressed.
javascript jquery html
Engineer
source share