Cannot set the max attribute for a number input


Hi, at line 24, I wanted to allow only a number between 1-100 to be entered. but the min and max do not seem to be working because I could still type in numbers smaller than 1 and bigger than 100. can someone help me with this?

Those attributes are working. Although you can still type values beyond the min and max, the page won’t allow you to submit them when they are inside a form.

really?? did the page give any warning(or does that need settings as well)when you clicked submit? because they won’t allow me to submit any number at the moment, even the ones within designated range.

It only gives a warning if the input is inside a <form> element.

But at least on Firefox inputs with invalid values are highlighted red by default, regardless if they’re in a <form> or not.

I have set the parent of input as form, but still no warning on Chrome. could you try type in on Firefox again, see if there would be a warning?

I’m getting a warning when I hit Enter, but not when the button is clicked. For it to work, the submit button must also be inside the same form.

1 Like