Good morning, friends!
Next, I want to make a function that if it reaches the maxlength of the input (in the case 2 characters), it jumps to the next input. I made the code below that is not running ...
var inputZin = $('.idade-viajantes only-number');
var jumpInput = function() {
if(inputZin.value.length == 2) {
$(this).parents(input).next.focus();
}
}
<input class="idade-viajantes only-number" name="idade" maxlength="2" type="text" onkeyup="jumpInput()"/>
<input class="idade-viajantes only-number" name="idade" maxlength="2" type="text" onkeyup="jumpInput()"/>
<input class="idade-viajantes only-number" name="idade" maxlength="2" type="text" onkeyup="jumpInput()"/>
<input class="idade-viajantes only-number" name="idade" maxlength="2" type="text" onkeyup="jumpInput()"/>
<input class="idade-viajantes only-number" name="idade" maxlength="2" type="text"/>
<script src="jquery.js"></script>
Previously, I had done a logic in pure javascript, but used id's on each input ... so I tried doing jQuery to use "parents" and "next" only that it's not rolling.
Thank you in advance!