Let’s say I have an array of objects
[{href: 'some_uri', 'class': 'this-css-class'}, {href: 'another_uri', 'class': 'that-css-class'}]
I now want to map that to a html list:
<ul>
<li class="this-css-class"><a href="some_uri">some_uri</a></li>
<li class="that-css-class"><a href="another_uri">another_uri</a></li>
</ul>
Assume I add another object to my array, I want to have a new <li> added to the list as well. Conversely, when I $('.that-css-class').remove() one of the list items, I want it to be gone in the array as well.
I would like to keep it in jQuery, as I don’t want to introduce another framework to the project.
Help greatly appreciated, this has been doing my head in.
Thanks.
Something like that ? : http://jsfiddle.net/RZPNG/4/
Selector way :