+ 1

How can I make a field in HTML mandatory to fill?

There's a line of code that makes a automatic text appear in the screen when the field is mandatory to fill in order to submit. I used to know, but I forgot. I tried to add the "required class="input"" line of code to my existing one, but that didn't work. https://code.sololearn.com/WjU62hj5U6Cs/?ref=app

28th May 2020, 6:06 PM
Fábio Gonçalves
Fábio Gonçalves - avatar
4 ответов
+ 1
Just add a required at the end of the input element. something like this <input type="password" name="password" required> On a totally unrelated note, what's with the periods in your code.
28th May 2020, 7:04 PM
Morse
Morse - avatar
0
I did how you said to do and still doesn't happen anything.
29th May 2020, 1:39 PM
Fábio Gonçalves
Fábio Gonçalves - avatar
0
My file is .php .Does that as anything to do with what is happening?
29th May 2020, 1:46 PM
Fábio Gonçalves
Fábio Gonçalves - avatar
0
It only works in a HTML file, not in a PHP one.
29th May 2020, 3:37 PM
Fábio Gonçalves
Fábio Gonçalves - avatar