我正在尝试了解如何设置javascript或jquery输入的html5类型的最大值和最小值。
<input type="number" max="???" min="???" step="0.5"/>
有没有人能给我带路
发布于 2013-10-11 19:16:23
试试这个:
<input type="number" max="???" min="???" step="0.5" id="myInput"/>
$("#myInput").attr({
"max" : 10,
"min" : 2
});
注意:这将仅将最大值和最小值设置为单输入
发布于 2013-10-11 19:15:26
尝尝这个
$(function(){
$("input[type='number']").prop('min',1);
$("input[type='number']").prop('max',10);
});
https://stackoverflow.com/questions/19316709
复制相似问题