Like This Site? 
 
RSS Feed Follow Us 

on Twitter! Be Our Fan!

Custom Attributes in HTML 5

Share this post!
 Vote this!

An interesting new part of HTML 5 is its formal support- or should I say endorsement- of custom attributes inside HTML elements. Technically it's always been possible to inject arbitrary attributes into an element and parse them using JavaScript getAttribute() method, but not without getting an earful from the W3C validator (not to mention some of your peers) each time. The following fails as valid HTML:

<div id="mydiv" brand="toyota" model="prius">
John is very happy with his Toyota Prius, because he saves on gas.
</div>   more...

0 comments:

Post a Comment