title: How to create a collection of jQuery elements and append them to the DOM?
body: <p>I'm looping over a list and need to create a <a href="http://api.jquerymobile.com/checkboxradio/" rel="nofollow">jQuery Mobile radio button</a> for each list element. All radio buttons should go inside a <code>div class="radio-controls"</code> which - once finished - are appended to the DOM.</p>
  
  <p>Here is what I'm trying:</p>
  
  <pre><code>    var label = $("&lt;label/&gt;").attr("data-" + $.mobile.ns + "iconpos", "notext");
        barrel = [];
  
      for (var i = 0; i &lt; myListitems.length; i += 1) {
        var item = myListitems[i];
  
        barrel.push(
            $("&lt;input type='radio' name='radio-" + this.uuid + "' value='radio-" + this.uuid + "-" + i +"' /&gt;" )
              .wrap(label)
              .checkboxradio()
          );
        }
      }
  </code></pre>
  
  <p>After the loop I have an jQuery array, which I need to append.</p>
  
  <p>But <a href="http://api.jquery.com/jQuery.makeArray/" rel="nofollow">makeArray</a> fails and returns</p>
  
  <pre><code>context is undefined
  </code></pre>
  
  <p>inside jQuery</p>
  
  <pre><code> if ( ( context.ownerDocument || context ) !== document ) {
  </code></pre>
  
  <p>which is said to be caused by the array not consisting of elements selected from the document (mine are still not added to the DOM), while <code>document.createFragement</code> does not work, because I think I cannot add jQuery objects to a fragment. Doing this:</p>
  
  <pre><code> var fragment = document.createDocumentFragment();
  
   // in my loop
   bullet = $("&lt;input type='radio' name='radio-" + this.uuid + "' value='radio-" + this.uuid + "-" + i +"' /&gt;" )
       .wrap(label)
       .checkboxradio()
   fragment.appendChild( bullet );
  
   // after loop, add to document 
   fragment[o.bulletsPos === "top" ? prependTo : appendTo](el);
  </code></pre>
  
  <p>returns this error:</p>
  
  <pre><code> Value does not implement interface Node.
  </code></pre>
  
  <p><strong>Question</strong>:
  Is there a way to generate a collection of jQuery items and append this to the DOM? Of course I can insert every item one-by-one, but I want to create the whole thing dynamic and insert once.</p>
  
  <p>Thanks for help!</p>