【发布时间】:2014-05-16 22:45:04
【问题描述】:
我想禁用鼠标右键单击并且不要在 Javascript 中更改光标位置。这是我的代码示例:
<input id="PhoneNumber" style="width: 160px;" />
$('#PhoneNumber').mousedown(function (e) {
if (event.which > 1) {
e.preventDefault();
} else {
//Do some work
}
});
但这不起作用。当我用鼠标右键单击时,它会改变插入符号的位置。
[更新] 适用于铬。无法在 IE 上运行
【问题讨论】:
-
适用于 chrome。无法在 IE 上运行
标签: javascript jquery html input mouse