如何知道ckeditor中是否按下了alt键?

时间:2015-11-23 07:15:20

标签: javascript jquery ckeditor

我想在ckeditor中按下alt + r时做一些事情。这是我的代码

[i for i in [["why","why","hello"],["why","why","bell"],["why","hi","sllo"],["why","cry","hello"]] if i[-1]=="hello"]

按下r返回82,但CKEDITOR.on('instanceCreated', function(e) { e.editor.on('contentDom', function() { e.editor.document.on('keydown', function(evt) { var code=evt.data.getKey(); if(code==82){ if (evt.data.altKey) { alert('ALt + R pressed'); } } }); }); }); 无效。

1 个答案:

答案 0 :(得分:0)

使用此:

if (evt.data.getKeystroke() == 88) {//'put value of alt keystroke 88'
    console.log('Alt Key Pressed');
    //Your function call 
}