With an input of type number, how to get the TEXT displayed on the input (not the value) when the value is invalid.
Exemple :
<form>
<input type="number" id="num" step="any">
</form>
If the user enter the invalid value "0..1" (instead of "0.1"), document.getElementById('num').value
return an empty string.
How to get with JavaScript the text "0..1" ?
Why this question ?
The goal is to provide better validation message. The input of type number is "tricky" and the behavior inconsistent, if the user enter " 5" in Firefox, it's an invalid number, I want to be able to display in my validation message why the number is invalid.