I have the following code
Inside Link which sets a value
data-value is a good attribute. but.. You can also add a " rel " attribute to your anchor tag. it describes the relation to the document where the link points to. And you can also use it to store a value.
Like This -
$("a").click(function(){
var page = $(this).attr('rel'); // save the attribute value here
sessionStorage.setItem("text",page);
/*save it in session storage if you want to send (or retrieve) this value to another page.
if not then use it easily without saving it in session storage*/
//Use it here
return false; // to stop the redirection if contains a link
});