如何在javascript中检测右键单击+剪切/删除/粘贴/撤消?

sne*_*aky 2 html javascript jquery menu right-click

在我的JavaScript/jQuery代码中,我有一个文本字段,当文本使用keyup事件更改时,我运行一个事件.但是目前我只考虑使用键盘进行的更改.

有没有办法可以检测文本字段文本何时更改,因为用户右键单击并单击剪切或删除或粘贴或撤消?

注意:这需要在IE9中工作,最好是Firefox和chrome,但肯定需要在IE9中工作.

谢谢

Tra*_*s J 5

jsFiddle Demo

使用jquery将输入事件绑定到元素,如下所示:

$('#myInput').bind('input',function(){
  //use this for the input element when input is made
  var inputValue = this.value;//for example
 });
Run Code Online (Sandbox Code Playgroud)