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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:56:07+00:00 2026-06-15T02:56:07+00:00

I am not sure if this is possible. If not I could add an

  • 0

I am not sure if this is possible. If not I could add an data-state or class, right?

Ok so my first question is… How can I add an active state on hover of <li> and remove it from previously hovered tag if new one is selected. I assume I need to use siblings for that but how do I make it go to :active I have no clues. If it’s not possible any option from above seems fine… I just wanna learn how.

#menubar li {
    background: rgba(20, 20, 20, .3);
    margin: 10px 0;
    padding: 5px 0;
    width: 50%;
    cursor: pointer;
}

#menubar li:active {
    width: 100%;
}


<ul id="menubar">
    <li><a href="head.php">Head</a></li>
    <li><a href="body.php">Body</a></li>
    <li><a href="settings.php">Settings</a></li>
    <li><a href="">None</a></li>
    <li><a href="">None</a></li>
</ul> <!-- menubar CLOSE -->

so as mentioned im not sure if it is possible to add active state to <li> but still I need to ask.

If not something like this is more then welcome.

<li data-state="active"></li>

or

<li class="activeItem"></li>
  • 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-15T02:56:08+00:00Added an answer on June 15, 2026 at 2:56 am

    You have to use classes:

    $('li').hover(function() {
        $(this).addClass('active');
    }, function() {
        $(this).removeClass('active');
    });
    

    The :active pseudo class is only for links (as pointed out by Juan Mendes)

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

Sidebar

Related Questions

I'm not sure this is possible, but in ruby, you can dynamically call a
Not sure this is possible, but looking to write a script that would return
I'm not sure if this possible but probably is fairly simple. I've made a
I'm not sure this is possible, but is there a syntax to be used
Not sure if this is possible: I want to use datatables to manipulate my
Not sure if this is possible. I want to grab the latest X stories
Not sure if this is possible in one Makefile alone, but I was hoping
I'm not sure this is even possible but I know if it is, the
I'm not sure if this is possible (complete non-flash developer speaking), but we have
I'm not sure if this is possible but I want to see objects created

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.