<style type="text/css">
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
}
</style>
...
<input type="number" placeholder="请输入正整数" onKeypress="inputCheck(event)" />
...
function inputCheck(e) {
// 通过判断输入的charCode来过滤掉小数点和减号
if (e.charCode == 45 || e.charCode == 46 || e.charCode == 69 || e.charCode == 101) {
e.returnValue = false;
}
}