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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:26:20+00:00 2026-05-23T22:26:20+00:00

I try to select a link in a browser if this link is available

  • 0

I try to select a link in a browser if this link is available in a sub-menu when I select the link with the parent class: hasSubMenu
My problem is that many links are selected when I do not want one…

<li style="z-index: 100;" class=""><a href="/#" class="hasSubMenu" style="background: none repeat scroll 0pt 0pt rgba(114, 130, 143, 0.17); color: rgb(68, 68, 68);">A propos<span class="subDown"></span></a><ul class="sub-menu" style="top: 32px; visibility: visible; left: 0px; width: 187px; display: none;"><li><a href="/contactez_nous.php" style="background-color: rgb(248, 196, 96); text-shadow: none; margin: 0pt; text-decoration: none; padding-left: 6px;">Contact</a></li><li><a href="/page.php?4" style="padding-left: 6px;">Mentions légales</a></li><li><a href="/page.php?5" style="padding-left: 6px;">Partenaires</a></li></ul><ul class="sub-menu" style="display: none; visibility: visible;"><li><a href="/contactez_nous.php" style="background-color: rgb(248, 196, 96); text-shadow: none; margin: 0pt; text-decoration: none;">Contact</a></li><li><a href="/page.php?4">Mentions légales</a></li><li><a href="/page.php?5">Partenaires</a></li></ul></li>

Jquery:

var exploded = window.location.href.split('/');
// alert(exploded[3]);
$('ul.sub-menu li a').each(function(){
    var items = $(this).attr('href');
    var item_clean = items.substring(1, items.length);
    if(item_clean == exploded[3]){
        $(this).parents().find('a.hasSubMenu:first').attr('style','background: rgba(114, 130, 143, 0.17) none repeat scroll 0 0;color: #444444;');
        $(this).attr('style','background-color:#F8C460;text-shadow:none;margin:0;text-decoration:none;');
    }
});

Thx for your answers

  • 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-05-23T22:26:21+00:00Added an answer on May 23, 2026 at 10:26 pm

    For your jQuery selector, use $('ul.sub-menu li a:first').

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

Sidebar

Related Questions

UPDATE If you try the form on this link http://jsfiddle.net/Matt_KP/BwmzQ/ the fiddle and select
I have this problem with onchange: <form class=form action=javascript:update();> <select name=calendar id=calendar onchange =
I have a DAO class which I'm using to try select/update/insert with hibernate and
Ok... changing the question here... I'm getting an error when I try this: SELECT
Here is my data structure alt text http://luvboy.co.cc/images/db.JPG when i try this sql select
If I try to run this query in SQL Server 2005: SELECT 1 WHERE
how to select all the data from many tables? i try `SELECT * FROM
I've a this query in mySQL (MyISAM): SELECT * FROM `links` WHERE `id` IN
I try this query from Oracle : select * from a_table@Postgres; Here is the
I try to use the SQL statement SELECT * FROM table ORDER BY column

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.