• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 465
  • Last Modified:

Key Down event not captured in IE

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
dyarosh
Asked:
dyarosh
  • 4
  • 3
1 Solution
 
dyaroshAuthor Commented:
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
 
leakim971PluritechnicianCommented:
0
 
dyaroshAuthor Commented:
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
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
leakim971PluritechnicianCommented:
0
 
leakim971PluritechnicianCommented:
0
 
dyaroshAuthor Commented:
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
 
leakim971PluritechnicianCommented:
You're welcome!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now