Friday, 30 December 2011

HTML5 - required Attribute

required Attribute

The required attribute specifies that before submitting an input field must be filled out .
Note: The required attribute works with the following <input> types: text, search, url, telephone, email, password, date pickers, number, checkbox, radio, and file.

Syntax

Name: <input type="text" name="user_name" required="required" /> 

Example

 <!DOCTYPE html>
<html>
<body>

<form action="demo_form.asp" method="get">
Name: <input type="text" name="user_name" required="required" />
<input type="submit" />
</form>

</body>
</html>

No comments:

Post a Comment