jQuery .wrap() isn't working
<p>I'm probably doing something wrong but I've tried all sorts of things and can't seem to get a collection of jQuery objects wrapped. The following just outputs the link HTML, unwrapped. Any ideas?</p>

<pre><code>$.each(sitemapSections, function(i) {
  var $sitemapSection = $(sitemapSections[i]);
  var $primary = $sitemapSection.find('a[data-level="1"]').wrap('&lt;h3&gt;&lt;/h3&gt;');

  $dropdownSections[i].html($primary);
});
</code></pre>

<p>EDIT - here's the markup (cleaned up):</p>

<pre><code>&lt;li id="product-solutions"&gt;&lt;a href="#link" class="alpha grid-6"&gt;Products &amp;amp; Solutions&lt;/a&gt;

  &lt;div id="ps-dropdown" class="dropdown-menu grid-20"&gt;
    &lt;div class="ps-dropdown-section"&gt;

    &lt;/div&gt;&lt;!-- .ps-dropdown-section --&gt;

    &lt;div class="ps-dropdown-section"&gt;

    &lt;/div&gt;&lt;!-- .ps-dropdown-section --&gt;

    &lt;div class="ps-dropdown-section"&gt;

    &lt;/div&gt;&lt;!-- .ps-dropdown-section --&gt;
  &lt;/div&gt;&lt;!-- .dropdown-menu --&gt;
&lt;/li&gt;
</code></pre>

<p>UPDATE - I got it! The comments who mentioned parent() is what I was missing. Here's the final code:</p>

<pre><code>$.each(sitemapSections, function(i) {
  var $sitemapSection = $(sitemapSections[i]);
  var $primary = $sitemapSection.find('a[data-level="1"]').wrap('&lt;h3&gt;&lt;/h3&gt;').parent();

  $dropdownSections[i].html($primary);
});
</code></pre>
