107k views
5 votes
Patrick is creating a form for his Web site, and he wants to have visitors provide their names. Which HTML5 code would ensure that users enter their first names prior to submitting the form?

User Gkee
by
6.3k points

1 Answer

1 vote

Answer:

required is the HTML5 keyword that will be used. See the snippet in the explanation.

Step-by-step explanation:

<form>

<label>FirstName</label>

<input type="text" name="firstname" required>

<button>Submit</button>

</form>

The above snippet will not allow the web page to be submitted until the firstname field is filled with text.

User HannaY
by
6.1k points