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 8791667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:52:30+00:00 2026-06-13T22:52:30+00:00

I have a menu with multiple ul items. What i want is change the

  • 0

I have a menu with multiple ul items. What i want is change the color of top menu text to red.

However this only works when i click in the first item, not in the children items.

For example, i want to click in hydrotherapy and change to red the word Services. The parent. Any idea?

$("nav.menu>ul>li").children().click(function() {
    alert("asd");
    var item1 = $(this),
        primeira_ul = item1.closest('.menu>ul#nav>li>a.t2');

    item1.addClass('font_red');
    return false;
});

demo

  • 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-13T22:52:30+00:00Added an answer on June 13, 2026 at 10:52 pm

    You can search for the first child of $(this) that is an a tag. Note that $(this) refers not to the event source, but the $("nav.menu>ul>li") element which is already your top level li.

    You probably also want to unset the siblings.

    $("nav.menu>ul>li").on("click", function() {
        var item1 = $(this),
            primeira_ul = item1.closest('.menu>ul#nav>li>a.t2');
    
        $(this).siblings().find("> a").removeClass('font_red');
        $(this).find("> a").first().addClass('font_red');
        return false;
    });
    

    JS Fiddle

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this menu structure: http://jsfiddle.net/Rochefort/szL2C/ everything is ok. But i want, hover effect
where I am using Jquery UI. I have an accordion menu, which has multiple
I have multiple menues on my page... <div class=menu> <div>Menu header</div> <div>Menu content</div>// should
I have a menu-bar and a tabbed pane in a frame, and i want
i have a menu contains of one item (item to exit application), i want
I have made a navbar at the top of my website which contains multiple
I have used Multiple select Box in edit form, displaying previously selected items in
I have CMenu instance on which I add multiple items. For one of the
How can i change the application name in VisualVM ? I have multiple applications
I want to parse Xml. In the xml there are multiple items, each item

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.