-2

I want to write event listener for short cut key Ctrl + Shift + v (Paste Plain text) in chrome is it possible? If so can any one share how to write it. First preference is for a pure Javascript listener.

Edit: I want to get the text which is going to paste in my editor before it is done.

Ramakrishna
  • 4,928
  • 3
  • 20
  • 24
  • possible duplicate of [javascript multiple keys pressed at once](http://stackoverflow.com/questions/5203407/javascript-multiple-keys-pressed-at-once) – Hacketo Jun 26 '15 at 09:24

1 Answers1

0

You can handle key's with jQuery handler keydown. Simple example with ctrl+shift+v

var first = null;
var second = null;
var third = null;
$(document).on('keydown', function ( e ) {

    if(first == null) {
        first = e.which;
    } else if(second == null) {
        second = e.which;
    } else if(third == null) {
        third = e.which;
    }
    if(first == 17 && second == 16 & third == 86) {
        alert( "You pressed CTRL + SHIFT + V" );
        first = null;
        second = null;
        third = null;
    }
});

$(document).on('keyup', function( e ) {
    first = null;
    second = null;
    third = null;
});