JQuery find a nested ul in an iframe with a class and replace it
<p>I have an iframe with a nested unordered list inside. I want to find the nested ul that has a class of 'expanded' and change it to 'collapsed'. </p>

<pre><code>&lt;iframe id='Catalog'&gt;
  &lt;html&gt;
    &lt;body&gt;
      &lt;ul id='items'&gt;
        &lt;li&gt;&lt;ul&gt;&lt;/ul&gt;&lt;/li&gt;
        &lt;li&gt;&lt;ul class='expanded'&gt;&lt;/ul&gt;&lt;/li&gt;
        &lt;li&gt;&lt;ul&gt;&lt;/ul&gt;&lt;/li&gt;
      &lt;/ul&gt;
    &lt;/body&gt;
  &lt;/html&gt;
&lt;/iframe&gt;
</code></pre>

<p>I have tried many things, but have not quite gotten it right. </p>

<p>Here is a sample of what I'm trying to get:</p>

<pre><code>$('iframe#Catalog')
            .contents()
            .find('ul#items li ul')
            .hasClass('expanded')
            .removeClass('expanded')
            .addClass('collapsed');
</code></pre>

<p>Thanks in advance!</p>
