$(".allow-decimal").keypress(function (e) {
if(e.which == 46){
if($(this).val().indexOf('.') != -1) {
return false;
}
}
if (e.which != 8 && e.which != 0 && e.which != 46 && (e.which < 48 || e.which > 57)) {
return false;
}
});
allow-decimal
onfocusout="this.value=Number(this.value).toFixed(4)"
No comments:
Post a Comment