Sunday, September 30, 2012

HTML5 New Attributes

HTML5 has added new attributes.Today, we would have brief overview of all the new attributes and elements added to HTML5.

Before moving ahead, to enable HTML5 on your web page, you need to add following line of code in HTML side

Placeholder attributes gives the watermark to the elements. So, this in turn tells you what we are expecting from the user and user too knows what needs to be entered in the textbox.

HTML to be added to design view to enable placeholder for textbox

Below is the final output you would see

REQUIRED Attribute
HTML5 has added new attribute named as 'required'. Setting this attribute makes the textbox a mandatory field and that cannot be left empty.
With addition of required attribute, you now don't have to write additional javascript to check whether the field is empty or not. Furthermore, if the field is left empty it alerts the user with message to fill out that particular field.

Lets see what needs to be done to get this feature in our application. Please add the following text in your design/HTML side

Below is the screenshot of what will be shown to user if the textbox is left empty and we simply click Submit button

Hope this article gives to some overview of new HTML5 attributes.

No comments:

Post a Comment