I have:
html:
<div>
<a class="1"></a>
<a class="2"></a>
<a class="3"></a>
<a class="4"></a>
</div>
js:
item = $('div a');
Which gives me an array of the 'a' elements. I want to add these elements again to the same array, so I tried:
item.push(item);
but what I ended up with is:
[a]
[a]
[a]
[a]
[[a],[a],[a],[a]]
instead of
[a]
[a]
[a]
[a]
[a]
[a]
[a]
[a]
What can I do to achieve this result?
$.uniquebehind the scene, so you can't do that. You should.get()the array and then push the duplicates.