|
$(document).ready(function() {
$('.pin').on('input', function() {
var value = $(this).val();
var l = $(this).attr("l");
if (value.length >= 4) {
$('#l'+(parseInt(l)+1)).focus().val("");
if(parseInt(l)+1 > 6)
{
$('#pass').focus();
}else{
$('#l'+(parseInt(l)+1)).focus();
}
}
});
});
<li><input type="text" placeholder="PIN" l="1" id="l1" class="pin" size="4" tabindex="1" maxlength="4" /></li>
<li><input type="text" placeholder="PIN" l="2" id="l2" class="pin" size="4" tabindex="1" maxlength="4" /></li>
<li><input type="text" placeholder="PIN" l="3" id="l3" class="pin" size="4" tabindex="1" maxlength="4" /></li>
<li><input type="text" placeholder="PIN" l="4" id="l4" class="pin" size="4" tabindex="1" maxlength="4" /></li>
<li><input type="text" placeholder="PIN" l="5" id="l5" class="pin" size="4" tabindex="1" maxlength="4" /></li>
<li><input type="text" placeholder="PIN" l="6" id="l6" class="pin" size="4" tabindex="1" maxlength="4" /></li>
|
|