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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:52:48+00:00 2026-05-25T09:52:48+00:00

I have a simple ul and need to be able to navigate up and

  • 0

I have a simple ul and need to be able to navigate up and down the different li, using a up and down button. That way when the up button is clicked and will select each li, until it gets to the top of the ul and then you can press the down button to navigate back down, selecting the next li, each time the button is clicked.

Not sure how to go about this…

    <div id="MainMenu">
        <ul>
            <li><a href="#">PATIENT TEST</a></li>
            <li><a href="#">QC TEST</a></li>
            <li><a href="#">REVIEW RESULTS</a></li>
            <li><a href="#">OTHER</a></li>
        </ul>
    </div>

I’m using the following jQuery code to switch the class for the active li…

 $("li:not(.active)").live("click", function() {
    $(this).addClass("menuActive");
    $(this).siblings().removeClass("menuActive");
});
  • 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-25T09:52:49+00:00Added an answer on May 25, 2026 at 9:52 am

    Probably something like this:

    Demo http://jsfiddle.net/Us4q9/3/

    <div id="MainMenu">
        <ul>
            <li class="active"><a href="#">PATIENT TEST</a></li>
            <li><a href="#">QC TEST</a></li>
            <li><a href="#">REVIEW RESULTS</a></li>
            <li><a href="#">OTHER</a></li>
        </ul>
    </div>
    <a href="#" id="btnUp">Up</a>
    <a href="#" id="btnDown">Down</a>
    
    
     $(document).ready(function () {
            $('#btnDown').click(function () {
                var $current = $('#MainMenu ul li.active');
                if ($current.next().length > 0) {
                    $('#MainMenu ul li').removeClass('active');
                    $current.next().addClass('active');
                }
            });
    
            $('#btnUp').click(function () {
                var $current = $('#MainMenu ul li.active');
                if ($current.prev().length > 0) {
                    $('#MainMenu ul li').removeClass('active');
                    $current.prev().addClass('active');
                }
            });
        });
    

    Or using keyboard navigation:

      $(window).keyup(function (e) {
                var $current = $('#MainMenu ul li.active');
                var $next;
                if (e.keyCode == 38)
                    $next = $current.prev();
                if (e.keyCode == 40)
                    $next = $current.next();
    
                if ($next.length > 0) {
                    $('#MainMenu ul li').removeClass('active');
                    $next.addClass('active');
                }
            });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple problem in using the editor. I need to be able
I have a simple Java class that I need to serialize to be stored
I have a simple application in which I need to let the user select
I have a simple web page that till now didn't need any login. It
i have very simple problem. I need to create model, that represent element of
I have a simple xml document that looks like the following snippet. I need
I have a simple javascript function that takes two variables. I need to pass
I currently have a simple rewrite that redirects /photos/2 to /photoviewer.php?photo=2 However I need
I have a simple table/model in rails, vat_rates . Administrators need to be able
I have a chart where I need to display a different bar for each

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.