How to do decimal validation using javascript?
there is a text box which should accept only 24.00 or 24 or any value less than 24.00
the text also must allow if 23.99 is entered.
could some one help me on this??
I tried this way,
if (document.forms[0].hours!= undefined) {
var val = document.forms[0].hours.value ;
if (val .match(/^\d{0,6}(?:\.\d{0,2})?$/)) {
alert("Invalid" +'${payType5Code}'+" Hours. The hours entered can not have more than 2 decimal places,and should be in the range of 0 to 24 ");
submitted=false;
return false;
}
}
thanks