mardi 24 mars 2015

Selecting the next (not immediately) input tag


If I have three input tags separated by span tags, like this



<input class="some-class" type="number" maxlength="4">
<span class="bull">&bull;</span>
<input class="some-class" type="number"maxlength="4">
<span class="bull">&bull;</span>
<input class="some-class" type="number" maxlength="4">


How do I select the next input tag using jQuery in order to do something? My jQuery code below does not select the next input tag using .next() function



$(':input').keyup(function (e) {
if ($(this).val().length == $(this).attr('maxlength')) {
$(this).next(':input').focus();
}
});




Aucun commentaire:

Enregistrer un commentaire