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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:14:43+00:00 2026-05-27T19:14:43+00:00

using chrome 15 on osx 10.6.8 When adding event listeners, I’ve found that putting

  • 0

using chrome 15 on osx 10.6.8

When adding event listeners, I’ve found that putting preventDefault in when a keypress event is used, I get mas issues.

Take a look here

uncomment the line with event.preventDefault(); on it and you’ll see the keypress event stops working. what’s the deal?

  • 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-27T19:14:43+00:00Added an answer on May 27, 2026 at 7:14 pm

    preventDefault() does exactly what it’s supposed to. It stops the default action of the key. If you want the default action of the key, then don’t call it.

    In both Chrome and Firefox, I see repeated keypresses, even when preventDefault() is uncommented from your fiddle. Perhaps you were losing focus.

    It would help us know what to suggest in it’s place if you describe more about what you’re trying to accomplish.

    In your jsFiddle, you are listening to keys at the document level. By the time the keystrokes propogate up to the document, they have already been processed by the individual objects that they are targetted at. If you want to intercept and prevent keys from being processed, you have to process them in event handlers on the objects they originally are targetted at. You can’t prevent default on keys from the document level. In this jsFiddle where I intercept the keystrokes on the first object they go to, you can see that they are entirely blocked. You may also want to be aware that cross-browser behavior is not perfect in this regard as there are some browser differences you can see here.

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

Sidebar

Related Questions

Problem I have a custom tab control using Chrome-shaped tabs that binds to a
I want to notify an user using Chrome browser. I need something powerful like
I know Firebug is the standard, but I find myself using Chrome a lot
When using Google Chrome, I want to debug some JavaScript code. How can I
Have just started using Google Chrome , and noticed in parts of our site,
Note: I'm using Google Chrome Currently I have this test page http://www.evecakes.com/doodles/canvas_size_issue.htm It should
When debugging browser-based apps using Google Chrome's Developer Tools, is there a way to
My drupal site (internal) will not display the TinyMCE editor when using Google Chrome
When using a browser to transform XML (Google Chrome or IE7) is it possible
When using HTML custom attributes it doesn't works in Chrome. What I mean is,

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.