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

  • Home
  • SEARCH
  • 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 8522581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:09:47+00:00 2026-06-11T07:09:47+00:00

So I have this list with some hover effect added through CSS. HTML: <li><a

  • 0

So I have this list with some hover effect added through CSS.
HTML:

<li><a href="#">Current Period</a>
  <ul>
        <li><a href="#">2012</a>
        <li> a href="#">2011</a> //...you get the point

CSS:

#nav a:hover {
    background-color: #fff;
    color: #333;
}

When the user hovers over current period a list of children elements appear (2012, 2011… which have children of their own). My problem is that users can click on “Current Period”. I have managed to remove the click by adding a class to the anchor like so:

<li><a href="#" class="noclick">Current Period</a> ....

CSS:

.noclick {
pointer-events: none;
cursor: default;
}

but this of course removes the hover feature. I want to keep the hover effect while making the button un-clickable (I was thinking javascript, but I want a more “direct” solution). I appreciate any help 🙂

  • 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-11T07:09:49+00:00Added an answer on June 11, 2026 at 7:09 am

    In your click handler test whether the clicked item has that class:

    $("#nav a").click(function(e){
         if ($(e.target).hasClass("noclick"))
             return false;
    
         // your other code here
    });
    

    Note that by testing the target element for the event you don’t then prevent the clicks on child elements from working.

    Or if the “noclick” class is not changed dynamically, i.e., those “noclick” links start out as and will always be “noclick”, you could change the selector so that your click handler isn’t bound to those particular elements:

    $("#nav a").not(".noclick").click(function() { ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this HTML file with some CSS styles, now I am trying to
I have a generic list. Some elements of this list belong to a parent
I have written this program, which sorts some ints using a functor: #include<iostream> #include<list>
I have some LINQ code that generates a list of strings, like this: var
I have some financial data gathered at a List[(Int, Double)], like this: val snp
I'm having some trouble figuring this out. I have an unordered list menu that
I have a list of elements like <ol> <li class=blah>some text <a href=#>test</a></li> <li
I have some code; (function($) { $('nav.top ul li').hover(function() { $(this).addClass('active').append('<span class=rightImage></span>').prepend('<span class=leftImage></span>'); });
I have this list of people with checkboxes next to their names. When you
We Have this : List<Person> listPerson ; Want to use the Data of listPerson

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.