Why do you have to re-select a JQuery element from a collection?
<p>I have a number of check-boxes on my page, each has a name attribute for its useful value.</p>

<p>I want to get a list of values for the checked items only. I can get a collection of elements like so...</p>

<pre><code>var checkedItems = $(".checkbox:checked");
</code></pre>

<p>Now I want to create the list (string) so I create a loop...</p>

<pre><code>var list = "";
for (var i = 0; i &lt; checkedItems.length; i++) {
    list += $(checkedItems[i]).attr("name") + "\n";
}
</code></pre>

<p>This works and gives me my list. But the question is, why do I have to apply the JQuery object thingy i.e. <code>$(...)</code> to use the attr property?</p>

<p>if I had the following instead it would not work...</p>

<pre><code>list += checkedItems[i].attr("name") + "\n";
</code></pre>

<p>But surely the array should be a collection of JQuery elements already? Why re-cast?</p>

<p><a href="http://jsfiddle.net/dGeNR/" rel="nofollow">Here is a JSFiddle</a> of the working example if anybody wants to try it</p>

<p>EDIT: Why does this work...</p>

<pre><code>var item = $("#item");
var name = item.attr("name");
</code></pre>
