我知道
我认为这可能很简单:
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'
}
});
}
我认为这可能很简单:
function textareaOnShiftAndEnter(){
$('textarea#someId').keypress(function(e)
{
if(e.which == 13 && e.which == 16)
{
//.. don't work for nothing
}
});
}
但是显然,它并不像我期望的那样工作。我如何检查 shift + enter
键的按下?
e.which
不能同时为13和16:P。你想要修改键,就像@Amadan在下面非常简洁地解释的那样 :) - Chev