html input number max min

<input  type="number" min="1" max="1000">
    $('input[type="number"]').on('keyup keypress blur change', function() {
        if (parseInt(this.value) > 1000) {
            this.value = 1000;
            return false;
        }
        if (parseInt(this.value) < 1) {
            this.value = 1;
            return false;
        }
    });
发布了84 篇原创文章 · 获赞 10 · 访问量 4416

猜你喜欢

转载自blog.csdn.net/AlphaBr/article/details/105635201