I have a textbox. Is there a way where the highest value the user can enter is 100 and the lowest is 0?
So if the user types in a number more than 100 then it will automatically change the value to 100 using a keyup() function and if user types in a number less than 0 it will display as 0?
My textbox is below:
<input type="text" name="textWeight" id="txtWeight" maxlength="5"/>%</td>
Can this be done using JavaScript?
Here’s a simple function that does what you need:
If the input is not numeric it replaces it with a zero