How can I make a field in HTML mandatory to fill? | SoloLearn: Learn to code for FREE!

+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

5/28/2020 6:06:58 PM

Fábio Gonçalves

4 Answers

New Answer

+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.

0

I did how you said to do and still doesn't happen anything.

0

My file is .php .Does that as anything to do with what is happening?

0

It only works in a HTML file, not in a PHP one.