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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:03:03+00:00 2026-05-21T14:03:03+00:00

I have a menu list, as I scroll over the menu list the related

  • 0

I have a menu list, as I scroll over the menu list the related divs are shown or hidden. This works fine with the following:

$('.ov_menu li').mouseover(function(){
        var div_show = ($(this).parent().attr('href'));

        $('.homepage_display').hide();
        $(div_show).show();
        $('.ov_menu li').css('background-color','#ffffff')
        $(this).css('background-color','#cceffc');

        return false;
});

What is the most efficient way to display the relevant div when I click on the menu item, without having to type out the above code again (but using the click event rather than the mouseover event).

Markup:

<div class="ov_menu">
        <ul>
            <a href="#new"><li>Create New Check</li></a>
            <a href="#in_progress"><li>In Progress Checks</li></a>
            <a href="#completed"><li>Completed Checks</li></a>
            <a href="#archived"><li>Archived Checks</li></a>
        </ul>
</div>

<div class="homepage_display" id="new">
Content
</div>

<div class="homepage_display" id="in_progress">
Content
</div>

<div class="homepage_display" id="completed">
Content
</div>

<div class="homepage_display" id="archived">
Content
</div>
  • 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-21T14:03:04+00:00Added an answer on May 21, 2026 at 2:03 pm

    Just extract it out to use a named function.

    function ShowSomething() {
        var div_show = ($(this).parent().attr('href'));
    
        $('.homepage_display').hide();
        $(div_show).show();
        $('.ov_menu li').css('background-color', '#ffffff')
        $(this).css('background-color', '#cceffc');
    
        return false;
    }
    
    $('.ov_menu li').mouseover(ShowSomething);
    //or
    $('.ov_menu li').click(ShowSomething);
    

    Simple example on jsfiddle

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

Sidebar

Related Questions

I have a menu list something like this: <ul class=submenuList> <li><a onclick=loadItem('Blue%20Orchid%20Press') id=Blue%20Orchid%20Press>class=on>Blue Orchid
I have a list menu in my php page. In this list menu i
I have a SELECT LIST MENU containing products and on this menu i use
I'm having some trouble figuring this out. I have an unordered list menu that
I have the following menu: <ul class=top-menu> <li><a_href=/Products title=Products><span>Products</span></a><ul> <li><a_href=/Products/List title=Product List><span>Product List</span></a></li> </ul>
I currently have a drop-line horizontal menu using an unordered list with the following
I have menu with few unordered list items as shown below. Now I need
I currently have the following code: <ul id=menu-list> <a href=index.php> <li>Home</li> </a> <li><a href=about.php>About</a></li>
Here's my problem: I have do create a menu/list of actions (which would be
I have a html select list menu,when user select an option he/she is redirected

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.