RSS

Daily Archives: January 10, 2014

HTML 5 required Attribute

HTML 5 introduces an easy way to validate required Input fields with-in a Form. Earlier we were suppose to use client or server side techniques to validate required fields, but now we don’t need them any more (at least for the non null values).

The introduced “required” attribute is boolean.

When its present with the input field, it specifies that the field must be filled out before submitting the form.

For Example: Username: <input type=”text” name=”usrname” required>

Image

Note: The required attribute works with the following input types: text, search, url, tel, email, password, date pickers, number, checkbox, radio, and file. And its not supported in Internet Explorer 9 and earlier versions, or in Safari.

 
Leave a comment

Posted by on January 10, 2014 in HTML

 

Tags: , , , , , ,