JavaScript: find the parent div given the class of the children
<p>My code looks like this</p>

<pre><code>&lt;div id=resultsdiv &gt;
&lt;div id=xxxx class=container&gt;
&lt;a&gt; class=results &lt;/a&gt;
&lt;a&gt; class=results &lt;/a&gt;
&lt;div id=zzzz class=default&gt;
&lt;p&gt; some default data &lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>I have a button called "default only" and When i click the button, all results class elements should be hidden and only the default class div should be displayed and in case any of the container div doesn't have any default class div, it should be hidden too, and once i click the button again the whole thing should be reversed Here my inner divs are dynamically created so I do not have an idea what their IDs are, so is there a way to achieve what I am looking for by only using the class names?</p>
