Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Tip: Use Data Attributes on Elements in HTML5 to Store Data

Learn how to store and retrieve data from the data attributes.


advertisement

We can store data in the elements through HTML5's data attributes. See below for an example on how to store and retrieve data from the data attributes.

The values are added to the anchor element through the data-value and data-options attributes. This is how you access the values:

alert('The ' + $("#elink").data("value") + ' name is ' + $("#elink").data("options").cn);

 

Visit the DevX Tip Bank

 





   
Srinath M. S. says: "I would love to leave a footprint in this flat world."
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date