Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8857621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:38:07+00:00 2026-06-14T14:38:07+00:00

Sorry for the confusing question but here’s what i’m trying to do. I have

  • 0

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:

<ul class="bNav">
  <li><a href="#">Home</a></li>
  <li><a href="#">The Artists</a></li>
  <li><a href="#">The Art</a></li>
</ul>

<ul class="bNav opp">
  <li><a href="#">Home</a></li>
  <li><a href="#">The Artists</a></li>
  <li><a href="#">The Art</a></li>
</ul>

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:

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

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

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!

damien

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T14:38:08+00:00Added an answer on June 14, 2026 at 2:38 pm

    From the docs:
    .is()
    Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.

    Try:

    $('.bNav.opp').addClass('nav').wrap('<nav class="navbar navbar-inverse"><div class="navbar-inner">');
    $('.bNav').not('.opp').addClass('nav').wrap('<nav class="navbar"><div class="navbar-inner">');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry for the confusing question, but what I'm trying to do is store an
Sorry if the question if confusing, but I'll make it clear here. What I'm
Sorry for such a silly question but Python docs are confusing... Link 1: Queue
Sorry for the confusing title, but it basically says it all. Here's the structures
Sorry if the title sounds confusing - but this is what I am trying
I'm really not sure how to word this question, but here goes... I have
Sorry if my last question is very similar, but I have another query of
EDIT Sorry for the confusion, here is my updated question. I am using FindBin
sorry for my confusing question. let me rephrase the details: $query = SELECT *
Sorry if the question title is confusing. Let me explain further. I am building

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.