jquery determines two decimal places and automatically deletes the number after two decimal places
Basically, if you enter 12.235689741
it will be converted to 12.23 without rounding
knows the basics of javascript You should be able to understand it
No explanation
$("#fileds").find("input").blur(function(){
var value=$(this).val();
if(value == null || value == ''){
return false;
}
if(!isNaN(value)){
var userreg=/^[0-9] ([.]{1}[0 -9]{1,2})?$/;
if(userreg.test(value)){
if(parseInt(value).toString().length > 5){
$ (this).val("");
alertMsg("The entered integer must not be larger than 5 digits");
return false;
}
}else{
var numindex = parseInt (value.indexOf("."),10);
if(numindex == 0){
$(this).val("");
alertMsg("The entered number is not standardized" );
return false;
}
var head = value.substring(0,numindex);
var bottom = value.substring(numindex,numindex 3);
var fianlNum = head bottom;
$(this).val(fianlNum);
}
}else{
$(this).val("");
alertMsg("Please enter Number");
return false;
}
});