我对document对象具有此代码:
$(document).on('keydown', function(event) {
event.preventDefault();
});
例如,是否有可能在子<textarea>
元素上放置异常,并允许该子对象正常按下键盘键?
根据CBroe的输入,解决方案是在有异常的元素调用keydown事件时调用stopPropagation():
$('textarea').on('keydown', function(event) {
event.stopPropagation();
});