I try masking but it not working for this. I need verify that an input value is between 1.00
and 99.99
in float. How can I do this?
Asked
Active
Viewed 165 times
-1

Rory McCrossan
- 331,213
- 40
- 305
- 339

kumar
- 1
- 2
2 Answers
0
if (yourInput < 100 && yourInput >= 1)
if you also want to control the number of decimals you could do this:
yourInput = yourInput.toFixed(2);

Carlos Fdev
- 745
- 6
- 24
-
I need it at runtime user can only enter value in float – kumar Oct 15 '15 at 12:16
-
That's quite different from the question: instead of validating, you want to restrict the allowed input. Have a look there: http://stackoverflow.com/a/19012837/2375207 – nicolallias Oct 15 '15 at 12:37
0
You can call this function on any event.
function abc(){
var textValue = document.getElementById("text").value;
if (textValue >= 100 || textValue < 1.00) {
alert("Please insertAmount between 99.99 and 1.00");
document.getElementById("text").focus();
return false;
}
}

brk
- 48,835
- 10
- 56
- 78