请告诉如何使用Ctrl+Enter↵</kbd> as Enter↵</kbd> using Jquery. I need it for chatting application.
如何使用 div 创建"<div id="divChatMessage" contenteditable="true"></div>')"
以下显示为我的代码
$('divChatMessage').bind('keyup',function(ev){
if(ev.keyCode == 13 && ev.ctrlKey){
if(document.selection && document.selection.createRange){
this.focus();
var range = document.selection.createRange();
range.text = "\r\n";
range.collapse(false);
range.select();
}else if(window.getSelection){
//i don't know what to do?
}
}
})