You can do this using dataset property of the element, using with or without jquery it work... i'm not aware of old browser
Note: that when you use dash ('-') sign, you need to use capital case. Eg. a-b => aB
function onContentLoad() {_x000D_
var item = document.getElementById("id1");_x000D_
var x = item.dataset.x;_x000D_
var data = item.dataset.myData;_x000D_
_x000D_
var resX = document.getElementById("resX");_x000D_
var resData = document.getElementById("resData");_x000D_
_x000D_
resX.innerText = x;_x000D_
resData.innerText = data;_x000D_
_x000D_
console.log(x);_x000D_
console.log(data);_x000D_
}
_x000D_
<body onload="onContentLoad()">_x000D_
<div id="id1" data-x="a" data-my-data="b"></div>_x000D_
_x000D_
Read 'x':_x000D_
<label id="resX"></label>_x000D_
<br/>Read 'my-data':_x000D_
<label id="resData"></label>_x000D_
</body>
_x000D_