using jquery to check if element has class and treat the chained element children individually
<p>Sorry for the confusing question but here's what i'm trying to do. I have a page with multiple (ul) items. I'm using jquery to manipulate the classes of the (ul)'s and (li)'s. What i'm trying to do is treat each (ul) as an individual as oppose to a whole. For example my:</p>

<pre><code>&lt;ul class="bNav"&gt;
  &lt;li&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;The Artists&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;The Art&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ul class="bNav opp"&gt;
  &lt;li&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;The Artists&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;The Art&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>What i'm trying to do with my jquery is if the 'opp' class is present then add a certain code to it. If it's not there then do something else. The problem i'm having is that when i do an if check, if the class is present, it will treat all (ul)'s as if they have that class. Here's my code:</p>

<pre><code>if ($('.bNav').is('.opp')) {
    $('.bNav').addClass('nav').wrap('&lt;nav class="navbar navbar-inverse"&gt;&lt;div class="navbar-inner"&gt;');
} else {
    $('.bNav').addClass('nav').wrap('&lt;nav class="navbar"&gt;&lt;div class="navbar-inner"&gt;');
}

$('.bNav &gt; li &gt; ul').addClass('dropdown-menu').parent('li').addClass('dropdown').find('a:first').attr('data-toggle', 'dropdown').addClass('dropdown-toggle').append('&lt;span class="caret"&gt;&lt;/span&gt;');  
$('.bNav ul ul').addClass('dropdown-menu').parent('li').addClass('dropdown-submenu');
</code></pre>

<p>Again, the code is treating all (ul)'s as one. so if the class "opp" is present in any of the (ul)'s, then it fires off the if statement for the "opp" class for ALL the (ul)'s. How do i make it work so that each individual (ul) is treated as such? Thanks for your help in advance!</p>

<p>damien</p>
