What I need to do is to store some data about the item.
For example, let's say I have an <li> list item , and I want to save some data about it in the item, for example, "This is item 1 of XYZ . "
The only way I know how to do this (which I don't want to do if I can avoid):
<li id='item1'>
Item 1
</li>
<script>
var e = document.getElementById('item1').innerHTML;
</script>
I really want something like this (which I'm sure impossible):
// example
<li id='item1' userdata='This is element 1 from XYZ'>Item 1</li>
.. of course, I would like to have access to it somehow through javasscript.
Alternatively, is there any other way to achieve this?
Thanks -
source
share