我
认为
这取决于你的操作系统中有多少设置。但是:对我来说,我可以输入点
.
输入字段。对于我的申请,这是不希望的。我想禁用小数,所有不是数字的东西
另外,jquery不检测数字字段中的点
https://codepen.io/jossnaz/pen/dLMmoQ
看起来像这样:
HTML格式:
Please type into the first input box some dots . then click out of the input box to trigger the change event <br> <br>
<input type="number" name="firstInput" value="....">
<input type="number" name="second" value="5">
<pre class="result"></pre>
Javascript代码:
$('input').on('change', function(){
$('.result').html(
'First input val: ' + $('input').first().val() + "<br/>" + "Second input val: "
+ $('input').last().val()
);
})