Alternative to jQuery .data()?
- by thebossman
I'm a big fan of jQuery's .data() method, but I can't always use it. Often times I am rendering html templates that I pass via AJAX and I need to attach metadata to each of the elements in the template. For example:
<ul>
{% for item in itemlist %}
<li metadata="{{ item.metadata }}">{{ item.name }}</li>
{% endfor %}
</ul>
I know attaching attributes to store data is bad practice (and it might not even work in older versions of IE). What is the best practice? Is there a good alternative to this method?