freeCodeCamp Challenge Guide: Use HTML5 to Require a Field

Use HTML5 to Require a Field


Problem Explanation

The required attribute works with almost all possible types of the input tag ( it doesn’t works because it doesn’t make sense for the buttons-like types or the ones with a default value e.g. type=range) and force the user to leave at least a minimum mark of the interaction with the required input when submitting ( select at least one checkbox, type at least one character into a text box, etc…)

Its use block the form form submission until the the required condition woudn’t be fullfilled

You can use the required attribute with a particular syntax: since it is a boolean value you might write justrequired without any value.

In this challenge you already have a form and a input element: it asks you to add the required attribute to the input element; remember that if something of the original code is modified or removed by accident you can always restart with a clean code using the reset all code button.

Good luck!

13 Likes