Thursday, May 30, 2013

HTML5: Custom attributes

Use data- attribute. The format is "data-*", where "*" is replaced with the desired custom attribute name, then set to the desired string value. For example:

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

Reference:
http://www.javascriptkit.com/dhtmltutors/customattributes.shtml

No comments: