What is the use of "required" attribute in HTML5?

Solution

HTML5 introduced a new attribute for <input> tag i.e "required" which is a boolean attribute and specifies that the input type must be filled with some data for the form to be submitted. In other words, to submit a form, the input type with required attribute should have some data and cannot be blank.

Example:

<input type="name" required>

Share this thread

Comments

Comments
comments powered by Disqus

Navigation

Social Media