I have the following HTML:
<table>
<tr><td><input id="startMonth" placeholder="MM" class="dateInput"></td><td>/</td><td><input id="startDay" placeholder="DD" class="dateInput"></td><td>/</td><td><input id="startYear" placeholder="YY" class="dateInput"></td></tr>
<tr><td><input id="endMonth" placeholder="MM" class="dateInput"></td><td>/</td><td><input id="endDay" placeholder="DD" class="dateInput"></td><td>/</td><td><input id="endYear" placeholder="YY" class="dateInput"></td></tr>
</table>
With the following jQuery script:
$('.dateInput').on('keyup', function () {
if (this.value.length >= 2) {
$(this).nextAll('input').first().focus();
}
})
The event fires, but focus is not changed. I tried removing the tags from between the form fields, and that didn't help either.