Right so I'm trying to work out a way I can check the elements in the object for a particular piece of data, and then filter them out if necessary.
I've got a simple list, I'm running through all the list items and putting them in an object. Later on I want to run through and check each element for a data id.
<ul id="test">
<li data-id="1">a</li>
<li>b</li>
<li>c</li>
<li>d</li>
<li>e</li>
<li>f</li>
<li>g</li>
<li>h</li>
<li data-id="2">i</li>
<li>j</li>
<li>k</li>
<li>l</li>
<li>m</li>
<li>n</li>
</ul>`
var holder = {};
i = 0;
$('#test li').each(function(){
holder[i]=$(this);
i++
});
$('#test').append(holder[2]);
holder.each(function(){
console.log($(this).attr('data-id'));
});
I'm sure one of you clever people out there will be able to tell me how to get this going in no time. It's probably painstakingly obvious!
Cheers for the help guys.