It's been a year or two since I last dabbled in jQuery and have attempted to write a simple "on key press move to the next element" script. However my first attempt has a lot a repetition. I just know there is a more elegant way to write this, probably using a dictionary of elements or such.
$("#DialFirst").keypress(function () {
$("#DialSecond").focus();
});
$("#DialSecond").keypress(function () {
$("#DialThird").focus();
});
$("#DialThird").keypress(function () {
$("#DialFourth").focus();
});
$("#DialFourth").keypress(function () {
$("#DialFifth").focus();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input id="DialFirst" name="DialFirst" type="text" value="" />
<input id="DialSecond" name="DialSecond" type="text" value="" />
<input id="DialThird" name="DialThird" type="text" value="" />
<input id="DialFourth" name="DialFourth" type="text" value="" />
<input id="DialFifth" name="DialFifth" type="text" value="" />
Usage: Type in each box, focus should move to the next.