I have a number input field:
<input type="number" class="field" min="0" step="0.01" required>
My language is en
As soon as I type 12, the value returns nothing it's empty, not NaN, undefined or 0 just an empty log

Is there a way to allow both comma and period? Or do I have to fallback to a simple input with some custom validation?
You can try this custom validation form for number you can allow it to insert comma , and dot . except for letters and other symbols. Thanks
JAVASCRIPT
function filter_letters_and_symbols(evt){
var hold = String.fromCharCode(evt.which);
if((/[a-z A-Z*!@#$%^&*()_/[\]}=+><{?":;'"|]/.test(hold))){
evt.preventDefault();
}
}
HTML
<input type="text" class="field" min="0" step="0.01" onkeypress="filter_letters_and_symbols(event)" required>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With