Monday, July 6, 2015

What are data- attributes good for?



    • The HTML5 data- attribute is a new addition that assigns custom data to an element. It was built to store sensitive or private data that is exclusive to a page or application, for which there are no other matching attributes or elements.

1 comment:

  1. Sathish, that doesn't exactly answer the question. Also, part of that definition might make you think its 'safe' to store sensitive data in the dom. I would answer: "they are good for storing simple numbers or string data in the dom, as part of an element." Also, since anybody can 'view source', this data is visible by anyone who wants to look - so not so good for sensitive/private data.

    ReplyDelete