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

The Archive Base Latest Questions

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

how to reset the keydown function using jquery? For example, I two ul list

  • 0

how to reset the keydown function using jquery?

For example, I two ul list of data and each have a document.keydown method to controll the scrolling either left or right.

            $(document.keydown(function(e1)
            {
                // ul list 1 - insert data

               if(e.which == leftArrowKey1)
               {
                       // scroll left

               }else if(e.which == rightArrowKey1 || e.which == spacebarKey1)

                      // scroll right                                               
               }
            });
            $(document.keydown(function(e2)
            {
                  // ul list 2 - insert data

               if(e2.which == leftArrowKey2)
               {
                  // scroll left

               }else if(e2.which == rightArrowKey2 || e2.which == spacebarKey2)

                  // scroll right                     
               }
            });

THe Problem

The problem is after I scroll either left or right of the first list, I can scroll the other list even after I insert data into it. For example, I insert data into list A, and can successfully scroll either left or right. Now I insert data into list B, I can not scroll either left or right of list B and it continues to scroll list A.

  • 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-27T09:16:26+00:00Added an answer on May 27, 2026 at 9:16 am

    I think you need to read up on the keydown function a bit. The example on that page will work for you.

    Also, you have a small problem with your code,

    $(document.keydown(e1)
    {
         // Your code
    });
    

    Should be

    $(document).keydown(function(e1)
    {
         // Your code
    });
    

    Edit:

    The easiest way to handle both lists at the same time is give them a class, lets say scrollable. One thing you will have to do is add a tabindex attribute to your ul elements so they are focusable: <ul class="scrollable" tabindex="1">. You’ll have to click on the list you want to scroll before the keydown event will fire.

    Note: each ul will need a unique tabindex (make the 2nd list’s tabindex=2)

    Now the jQuery is quite simple:

    $('ul.scrollable').keydown(function(event)) {
        // Your scrolling code
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to reset stop word list in mysql for FULLTEXT search. I have
I used jquery live search for live search. I have this html. A list
While reset and checkout have different usages most of the time, I can't see
I am using YUI reset/base, after the reset it sets the ul and li
How do I completely reset my Visual Studio 2008 toolbar? Right now I have
I am using the editArea library and jquery to do what i need... http://www.cdolivet.com/index.php?page=editArea&sess=2b8243f679e0d472397bfa959e1d3841
I have a table listing with a 'notes' field in each row. I'd like
How can I reset jquery slider so it as set default values as calls
I want to reset the form after calling an ajax function. This is the
I am using facebox which uses jQuery 1.2.1 on my website here http://www.pointclickshoot.com/beta2 The

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.