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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:41:42+00:00 2026-06-18T02:41:42+00:00

I was using jQuery live() function to detect when the user was pressing some

  • 0

I was using jQuery live() function to detect when the user was pressing some special keys (arrows, etc.):

$('.TextBox1').live('keydown', function(e) {
    var keyCode = e.keyCode || e.which;
    if (keyCode == 40) {
        e.preventDefault();
        // ...
    }
});

It was working fine for a couple of months when suddenly yesterday it stopped working, preventing every line of JS code below it from executing. I have tried to replace it with the .keyup function but this has not helped. What could have happened?

  • 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-18T02:41:44+00:00Added an answer on June 18, 2026 at 2:41 am

    I assume you’ve updated to the latest version of jQuery? live() has been deprecated since jQ1.7, and is now removed as of 1.9.

    Instead, you should use on() with a delegate parameter:

    $(document).on('keydown', '.TextBox1', function(e) {
        var keyCode = e.keyCode || e.which;
    
        if (keyCode == 40) {
            e.preventDefault();
            //...
        }
    });
    

    Note that for best performance you should replace document in the above example with the closest parent element of .TextBox1 which is not dynamically appended to the DOM after page load.

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

Sidebar

Related Questions

I have some code here: $(document).ready(function() { $(#querybox).live(keyup, function(e) { var code = (e.keyCode
I am using jQuery load() function to load some pages into container. Here is
I'm using jQuery CSS function to style some elements $element.css(style); This works, but a
I am using jQuery 1.7.1 on my site and using the .live() function for
I been sort of using jquery livequery plugin and jquery live together. However now
I am using jQuery datatables to display some data. Each row has an edit
Hey I used the following function to load a page using Jquery mobile $.mobile.changePage(
I am using jQuery Templates successfully but I have a blur function that is
I'm considering using live() to bind an event handler to a function I haven't
I am using JQuery .live to listen for a custom event, ie not .click,

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.