퍼블리셔/jquery

input[type="text"] 숫자만 입력

onSlow 2020. 4. 6. 10:47
반응형
$("input[type='text']").on("keyup", function() {
    $(this).val($(this).val().replace(/[^0-9]/g,""));
    
    //다음 input 이동
    if (this.value.length == this.maxLength) { 
        $(this).next('input[type="text"]').focus(); 
    }
});
반응형