required Attribute :
Definition and Usage The required attribute is a boolean attribute. When present, it specifies that an input field must be filled out before submitting the form.
Note: The required attribute works with the following input types: text, search, url, tel, email, password, date pickers, number, checkbox, radio, and file. Differences Between HTML 4.01 and HTML5 The required attribute is new in HTML5. D
ifferences Between HTML and XHTML In XHTML, attribute minimization is forbidden, and the required attribute must be defined as
| Example | ||
|
<form method="get"> <input type="text" name ="name" > <input type="text" name ="family" required > <input type="submit" value="Send"> </form> |
code | |
| output | ||