DEV/javascript, jQuery

[javascript] 자동 다음 탭 이동 (focus 이동)

꼭두새벽에비명소리 2020. 5. 24. 15:11

input nubmer > maxlength 입력 후 자동 탭 이동 (핸드폰 번호 숫자 4자리 입력후 자동 탭넘김)


maxelngth 만큼 텍스트 입력 후 다음탭으로 focus 이동


```


<input type="text" id="input1" maxlength="4" >
<input type="text" id="input2" maxlength="4" >

`

$('#input1').on('keyup', function() {
    if(this.value.length == 4) {
       $('#input2').focus()
    }
});

`