我有一点点 HTML
<input id="legalWellName" readonly data-bind="value: LEGAL_WELL_NAME" class="welllabel" />
这个脚本:
$('#legalWellName').keyup(function (e) {
if (e.stopPropagation) { e.stopPropagation(); }
if (e.cancelBubble != null) { e.cancelBubble = true; }
});
$('#legalWellName').keydown(function (e) {
if (e.stopPropagation) { e.stopPropagation(); }
if (e.cancelBubble != null) { e.cancelBubble = true; }
});
$('#legalWellName').keypress(function (e) {
if (e.stopPropagation) { e.stopPropagation(); }
if (e.cancelBubble != null) { e.cancelBubble = true; }
});
但是,如果我点击 legalWellName 输入并点击 BACKSPACE,它就像我在浏览器 (IE9) 中点击了 BACK。BACKSPACE 有什么特别之处吗?我已经设置了只读,所以没有其他键有任何效果(我什至不需要 stopPropagation 逻辑)。如何防止 BACKSPACE 生效?