0

I have a div where I want the user to input a number that is between 0.05 and 0.5. I did it this way:

<input id="TS_dist" class="tableButton" type="number" maxlength="1" size="5" value="0.2" />

The problem is that when I am puting a value I cannot use the zero, it is not working, the . is not either. Only 1-9 numbers are accepted.

My browser is firefox.

Do you have any idea what I am doing wrong?

Thanks

1
  • the first thing you're doing wrong is not defining your own requirements. For example, is 0.1234567890000 between 0.05 & 0.5, or not? and how about 0.050000? Commented Aug 10, 2015 at 11:54

3 Answers 3

1

By default the value increases/decreases by 1. Add a step attribute to change this behaviour:

<input step="0.05" id="TS_dist" class="tableButton" type="number" maxlength="1" size="5" value="0.2" />

http://jsfiddle.net/uh44h3y8/1/

Sign up to request clarification or add additional context in comments.

Comments

0

Try adding, step="any" in this input.

Comments

0

add step=0.1on <input> field that will work

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.