JavaScript
숫자 키패드 입력시 다음 input으로 이동
입방정
2024. 1. 17. 17:18
728x90
<div class="inp_sel">
<input type="tel" placeholder="4자리" maxlength="4" class="inputs">
</div>
<div class="inp_sel">
<input type="tel" placeholder="4자리" maxlength="4" class="inputs">
</div>
<script>
$(function() {
$(".inputs").on('keyup', function () {
var charLimit = $(this).prop("maxlength");
if ($(this).val().length >= charLimit) {
$(this).next('.inputs').focus();
return false;
}
});
});
</script>
728x90