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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:44:59+00:00 2026-06-05T15:44:59+00:00

jsFiddle demo link Hi Guys, I want to bind the keypress event handler when

  • 0

jsFiddle demo link

Hi Guys,
I want to bind the keypress event handler when i click the div layer as given in the above demo. The feature is to use the delete key to remove the selected layer.

But when i hit the delete key, the keypress handler doesn’t fire. Please suggest.

  • 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-05T15:45:01+00:00Added an answer on June 5, 2026 at 3:45 pm

    Remove ‘()‘:

    $this.on("keypress", keyAction);
    

    You are adding undefined as handler: $this.on("keypress", keyAction()) is equal to $this.on("keypress", undefined) in your case, as keyAction function does not return anything.

    Also your div must be focusable, in order to receive keyboard events. For that reason you need to add tabindex on it:

    <div class="dragClass" tabindex="0">
    

    Then in selectAction focus your div to receive keypress event:

    $this.focus();
    

    This is the DEMO

    For more information about adding keyboard events on static elements such as div, look at here:

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

Sidebar

Related Questions

Please see the demo here: http://jsfiddle.net/Freewind/Vkp4U/ The html: <div class=outer> <div class=x>x</div> <div class=y>y</div>
http://jsfiddle.net/FS4zT/ If you visit the above link you see what am describing below. Summary:
Code in here: jsfiddle Demo I wanna to get the div#content height when it
Here's some code to illustrate the problem I'm running into. jsFiddle Demo <div class=normal>
Im trying to bind/live a click event when an other is done. So I'm
this is the demo : http://jsfiddle.net/KwYjr/10/ how to set the blue div's width is
I want to show a a DIV on image / link hover and i
Please, Find the jsfiddle demo here . I want to take the navigation list
Here is the jsFiddle demo link. I can see the alert getting fired after
Currently I have a stacked bar chart like this ( jsfiddle demo ) I

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.