Firefox input box treats decimal min as increment - html

I have noticed that Firefox (unlike any other browser) is treating the min=".1" tag as the required decimal rather than the minimum number that can be accepted in a input type="number" box like this one:
<input id="numberInput" type="number" min=".1" value="1">
If I set it to 1 or any other whole number, a red box will appear around the input (implying the input is invalid). But if the input is changed to 1.1 or any other number ending in .1 (such as 2.1 or 10.1) it removes the red box, implying that this value checks out.
Here is a fiddle
Anyone know what is going on here?
Before you tell me, I do know that I can add step="any" to fix this "problem", but that seems like it should be unnecessary to do given that MIN is just supposed to set the floor on the input based on the HTML5 standard as described here

Related

HTML form input number field truncates number after first decimal if the second decimal is a zero, but not if the first decimal is a zero

My code looks like this:
<input id="tt" name="tt" type="number" value="106.00" min="0.00" step="0.01" class="form-control input-md" oninput="calc()">
Now in the calc javascript function I have tried the following:
_("tt").value=total.toFixed(2);
_("tt").value=parseFloat(total).toFixed(2);
and both times I have this weird behaviour in Firefox (and only in Firefox) that the number field can show "106.00", for instance, but instead of "106.10" it shows "106.1" , i.e., there it truncates the last zero. I want it to show "106.10" as is it a monetary value. I am a bit at a loss as to why this odd behaviour in Firefox. Does anyone have an idea how to solve this?

HTML Input allow decimal value but still increment by whole numbers

<input type="number" placeholder="Can be a value like 4.23" step="0.01">
This accepts decimal numbers, but makes the + / - controls increment by 0.01... not very user friendly. I thought perhaps something like this might work...
<input type="number" placeholder="Doesn't allow a value like 4.23" step="1.00">
However my browser (Chrome 85) just rounds this back to 1 and rejects 4.23 as invalid.
Some have suggested that using any is the solution... I disagree as I want the field to only allow a maximum of 2 decimal places.
<input type="number" placeholder="Allows 4.2333333333333" step="any">
It seems to me that the increase/decrease step function should not be coupled with the validity of the number, it should just change the way that the + and - buttons work.
I searched around and found others asking the same question, but I haven't found a resolution.

HTML5 input type number doesn't allow decimal

Have a form with an input type number. See my code below for the actual input.
<input min="0" placeholder="25.00" step="0.01" type="number">
Whenever I input a decimal, the input empties out. May just be having morning brain farts, but I have no clue what the issue could be? Tried changing step to 0.01 and same issue even though I didn't expect it to work in the first place. Issue is happening in Chrome so it's not specific to browser. I have checked all Javascript on our side and there is nothing that would be affecting the input. Thanks in advance.

Change the Increment Value of HTML Number Input - Decimals

Is there any way to change how much a number is incremented when using the up/down arrows on a HTML number input form?
<input type="number" step="any" value="0.00000000"></input>
I'm working with tiny numbers, it would be nice if the up/down arrows incremented just 0.00000001 at a time, instead of a whole number.
0.00000000
0.00000001
0.00000002
0.00000003
Instead of
0.00000000
1
2
3
I doubt very much if there is an easy way to do this, just though I'd ask and see if anyone else has a workaround or method as I'm sure many people experience a similar issue.
Thanks,
The step attribute is for this. Your code now has the value any, which means that any values are accepted and the step size is the default, 1. Replace it by a specific number to set the granularity and the step size. Example:
<input type="number" step="0.00000001" value="0.00000000">
Note: The end tag </input> is invalid in HTML syntax for HTML5. In XHTML syntax it is allowed, but “self-closing tags” are recommended instead of it, e.g. <input type="number" step="0.00000001" value="0.00000000" />.

Forbid letters in number field in html5

I want to prevent the user from entering non-numeric characters in a textfield for telephone number in HTML5. I tried this, but it doesn't forbid non-numeric characters:
<input type="tel" name="usrtel"><br>
I tried using type=number as well, but that gives me a up and a down arrow to increase or decrease the value, which is not useful for telephone numbers. How can I accomplish this?
You can use pattern attribute with a regex \d*
<input type="tel" name="usrtel" pattern="\d*" />
Demo (After typing in the box, just click anywhere outside the box, if you type in anything except the integers, it will show a red box, else it will stay normal)
Demo 2 (With custom message and submit button)
As you commented, you can change your pattern value to ^[0-9]{3,45}$ where user will have to input minimal of 3 digits to maximum of 45 in length.
Demo
<input
type="tel"
name="usrtel"
pattern="^[0-9]{3,45}$"
title="You can only enter numbers, with a minimal of 3 characters
upto 45 characters are accepted."
required="required"
/>
In the above markup, am using a title which will throw a custom error to your user.