【发布时间】:2011-08-06 15:04:17
【问题描述】:
我有以下代码:
document.onkeydown=function(e) {
if (e.which == 13 && isCtrl) {
log('Ctrl CR');
} else if (e.which == 17) {
isCtrl = true;
};
我需要在光标位于输入文本区域的位置插入回车/换行。 现在想想,我可能应该使用 textarea 选择器而不是 document.onkeydown,但是 $('textarea').onkeydown 不起作用。
【问题讨论】:
-
$('textarea').keydown,没有“开”。 -
天啊!谢谢!我对必须一起学习 js 和 jQuery 感到困惑。
标签: javascript jquery