What is the correct way to store some data in `<a>` anchor tag?

html, javascript, jquery

Solution

If you want the data to stored temporarily (ie only for the duration of the page) then using the .data() api is the right way

Problem

i usually use `data-***` to store some data. ``` <a href="#" data-address="some data">click</a> ``` i can get it in jquery using ``` alert($("a").data("address")); ``` it works fine. but i want to know is it the right way of doing and is there any compatibility issues?? or does i need to use the `rel` ie: ``` <a href="#" rel="some data">click</a> alert($("a").attr("rel")); ``` i updated a fiddle http://jsfiddle.net/suhailvs/XYZQK/

Original source