?
Solved

Key Down event not captured in IE

Posted on 2012-09-21
7
Medium Priority
?
455 Views
Last Modified: 2012-09-21
I am using the following JQuery and my Keydown event doesn't seem to be "firing".  Can someone please tell me what I may be doing wrong?  When I press the <CTRL> key I only get the alert when I release it.  Same thing when I press the V key.  I am using IE 8.

$(document).ready(function()
{
      var ctrlDown = false;
      var pasteFlag = false;
      var ctrlKey = 17, vKey = 86;
      
      $(document).keydown(function(e)
      {
            if (e.keyCode == ctrlKey) alert("Ctrl True");
            if (e.keyCode == vKey) alert("V True");
      }).keyup(function(e)
      {
            if (e.keyCode == ctrlKey) alert("Ctrl False");
            if (e.keyCode == vKey) alert("V False");
      });
      
      $(".no-edit").keydown(function(e)
      {
            return false;
      });
});
0
Comment
Question by:dyarosh
  • 4
  • 3
7 Comments
 

Author Comment

by:dyarosh
ID: 38421558
KeyDown event registers outside the textbox but not inside.  Can someone tell me how I might capture the KeyDown event in the textbox?  What I'm trying to do is to capture someone trying to copy text into a textbox on a form.
0
 
LVL 83

Expert Comment

by:leakim971
ID: 38421617
0
 

Author Comment

by:dyarosh
ID: 38421671
Try putting a textbox on the form and see if it works.  When I have a textbox, I don't get the keydown event inside the textbox.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 83

Expert Comment

by:leakim971
ID: 38421687
0
 
LVL 83

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 38421711
0
 

Author Closing Comment

by:dyarosh
ID: 38421880
Thank you.  I'm still not able to do exactly what I need but you solved the problem I posted.  I may be posting another problem if I can't figure it out.  Thanks.
0
 
LVL 83

Expert Comment

by:leakim971
ID: 38421887
You're welcome!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.
Suggested Courses
Course of the Month16 days, 23 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question