I am working on a web application and using javascript to restrict or round off a value. Whenever I enter any decimal value in a textbox, it should be rounded off to .25, .50, .75, or .00. any idea how to do that? Even if am able to enter only .25, .50, .75 and .00 is also fine… but how to restrict for only these specific values?
Share
In case it’s not obvious from Jon Taylors answer, the appropriate way of using if statements to solve this is the following: