HTML CSS examples for HTML Tag:input
The required attribute is a boolean attribute to set if an input field must be filled out before submitting the form.
The required attribute works with the following input types: text, search, url, tel, email, password, date pickers, number, checkbox, radio, and file.
In XHTML, the required attribute must be defined as <input required="required" />.
An HTML form with a required input field:
<!DOCTYPE html> <html> <body> <form action="/action_page.php"> Username: <input type="text" name="usrname" required> <input type="submit"> </form><!--from w w w .jav a2 s .c o m--> </body> </html>