更新时间:2022-11-16 11:01:06
In HTML 5 you can do this with the data-*
attribute:
<a id="myDiv" data-***Id="123">...</a>
Since you are using jQuery, you may also want to check the jQuery Metadata Plugin. It will allow you to store and parse JSON metadata in the class attribute, and your markup will still validate.
You would be able to insert your metadata like this:
<a class="your_class {***Id: '123'}">...</a>
And extract it as follows:
var data = $selectofA.metadata();