One of the methods that I usually use (instead of HTML5 data) is to use hidden input tags, for example.
<a href="#" id="containing_element"> Content <input type="hidden" id="key" value="value" /> </a>
Then, if you don't mind the jQuery example.
$('a#containing_element').click(function(){ var data = $(this).children('input#key').attr('value'); });
Simple, it checks, it works now , and you can use it to store any information that you like (even arrays if you serialize them and htmlencode them)
source share