如何检查是否在textarea中使用'shift'键按下了'enter'键

Dev*_*vWL 3 javascript jquery enter keypress shift

我知道shift key代码是16,enter key代码是13.

//@ catching any 'enter' keypress in textarea.
    function textareaOnEnter(){
        $('textarea#someId').keypress(function(e)
        {
          if(e.which == 13)
          {
            //.. works only for 'enter'
          }
        });     
    }
Run Code Online (Sandbox Code Playgroud)

我认为它可以像这样简单:

    function textareaOnShiftAndEnter(){
        $('textarea#someId').keypress(function(e)
        {
          if(e.which == 13 && e.which == 16)
          {
            //.. don't work for nothing
          }
        });     
    }
Run Code Online (Sandbox Code Playgroud)

但当然它根本无法正常工作.如何检查shift + enter按键?

Ama*_*dan 6

if (e.which == 13 && e.shiftKey)
Run Code Online (Sandbox Code Playgroud)

Shift,Ctrl和Alt是修饰键,它们在事件数据中获得自己的标志.