+ 1
Restriction of input type
Hello everyone! Please, could you provide a solution to the restriction of input? For example, "only digits" would make no effect on the input box if key pressed other than digit or vice versa with text (characters). Thanks in advance!
4 Respuestas
+ 5
Kekit
Kind of, but not entirely true. There's also 'email', 'tel' and 'url' for e-mail phone number and URL, respectively.
But value of input 'type' attribute only helps by means of displaying relevant optional button on the keyboard, depending on attribute value. For example the @ button is shown for 'email' or 'www' button shown for 'url' input.
Yet again, it does not enforce restriction, thus obviously, validation is still in order.
https://www.w3schools.com/html/html_form_input_types.asp
+ 3
Not exactly sure what you wanted, but as I understand it <input type="number" /> allows digits and formatting characters e.g. decimal point, no alphabet nor others.
I'd suggest you to add more info on what it is you actually are looking into.
+ 3
For Java
You can't, because that's how SoloLearn code playground works.
Instead, you need to add scripts in your code to validate user input.
For JavaScript, you can specify input type.
+ 2
Ipang I suppose that this is answer to me)) 'type=' attribute of input restricts user from using other than 'type'. Correct?