The code below ensures that my entry is only numeric with 2 decimal.
<input type="text" maxlength="10" name="numPrice" value="1.00">
$("input[name='numPrice']").keyup(function(){
if(!(/^\d+(\.{0,1}\d{0,2})?$/.test(this.value)) ){
this.value = this.value.substring(0, this.value.length - 1);
}
return this;
});
However values such as 1&.0 is not rejected by the code above. Did I miss something?