I would like to understand if using pre-made elements withn an HTML tag consider to be valid. I have start to use it all over my HTML to make my code become more generic and less breakable. However I am unaware if this is valid and supported by all browsers.
For example , I am doing something like that :
<a class="item-class" href="...' itemname="something">
now assume I am doing an jquery onclick event for all item-class I can do
$(this).attr("itemname")
kind of passing parameters to jquery events.
What you should be using for this sort of meta data, as per the HTML5 spec is the data-* attribute. It works basically the same, it’s just you use `data-itemname=”itemname” instead.
The is also a proper jQuery function for editing/retrieving these values: