html限制输入框只能输入数字
<div class="col-sm-8"> <#form:input path="quantity" maxlength="10" class="form-control required" onblur="value=zhzs(this.value)"/> </div> //限制数量只能输入数字 function zhzs(value) { value = value.replace(/[^\d]/g, '').replace(/^0{1,}/g, ''); if (value != ''){ value = parseFloat(value).toFixed(0); } else{ //value = parseFloat(0).toFixed(0); value=null; } return value; }