Setting the maximum value is less than the number in the input field based on the decimal fraction

I create an input field that accepts any number of decimal places. I want to test this input as a number equal to 5 or more and less than 100. Using the minand attributes max, I was able to create the following HTML fragment. It functions correctly in every browser, but it looks awful.

<input type="number" step="any" min="5" max="99.9999999999999999" required>

Check

Is there a decent way to do this (without rounding up fraud)?

I know that this can be easily solved using JavaScript, but I wonder if there is a decent way to do this using just HTML. I am trying to verify the input of users having HTML5 form validation but not JavaScript. Checking this entry on the server side forces the user to load the page again, which I am trying to avoid.

+4
source share
1 answer

Perhaps you want to include these css styles in <head>from Google, this makes the input fields better than the standard input fields from your browser:

<link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons1.css">
-2
source

Source: https://habr.com/ru/post/1611734/


All Articles