JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css">
<script src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>
<div data-role="page" data-theme="b" id="jqm-home">
<div data-role="content">
<form id="autoTab">
<label for="name">Text Pin #1:</label>
<input type="text" name="txtPin1" id="txtPin1" value="" class="txtPin" placeholder="Please enter Pin #1"/>
<br />
<label for="name">Text Pin #2:</label>
<input type="text" name="txtPin2" id="txtPin2" value="" class="txtPin" placeholder="Please enter Pin #2"/>
<br />
<label for="name">Text Pin #3:</label>
<input type="text" name="txtPin3" id="txtPin3" value="" class="txtPin" placeholder="Please enter Pin #3"/>
<br />
<label for="name">Text Pin #4:</label>
<input type="text" name="txtPin4" id="txtPin4" value="" class="txtPin" placeholder="Please enter Pin #4" maxlength="4"/>
</form>
</div>
</div>
JavaScript
$('.txtPin').keypress(function() {
var value = $(this).val();
// Let's say it's a four digit pin number
// Value starts at zero
if(value.length >= 3) {
var inputs = $(this).closest('form').find(':input');
inputs.eq( inputs.index(this)+ 1 ).focus();
}
});