[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 353
  • Last Modified:

How to check for keystroke combination using javascript

I have a web form that is populated by another application that "scrapes" data from an application and then "pastes" the data into my web form.  Don't ask why - just accept that this is the way we have to do it.

The problem with the form is that the user can edit the data once the data has been "pasted".  What I need to do is to check for the <CTRL>V combo and if pressed allow the text to be entered and when pressed again, to disable the field.

I know the "Keydown" event fires when I press the <CTRL> key (key code=17) and the "Keydown" event fires when I press the v (key code-17 - doesn't matter whether v or V is pressed).  What I don't know how to do in Javascript is capture the combination of the <CTRL>V.  If I can figure that out I can check the status of the field's enabled flag and flip it (i.e. set it to false if true and true if false).

Any help is greatly appreciated!
0
dyarosh
Asked:
dyarosh
1 Solution
 
dyaroshAuthor Commented:
Yes.  Thank you.  I can modify it for my needs.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

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