<input type="number" placeholder="Number of people*" class="user_number" min="1" max="5">
let user_number = document.getElementsByClassName("user_number");
if($(user_number).val() > 0){
console.log($(user_number).val());
}
但当我把任何超过0控制台不显示帮助请
1条答案
按热度按时间luaexgnf1#
您可以为"input"事件附加一个事件侦听器,以便在每次更改值时检查该值。