0
点赞
收藏
分享

微信扫一扫

禁止双击选中文本

郝春妮 2022-06-30 阅读 191

禁止双击选中文本
onselectstart 方法
// ie和chrome都支持的onselectstart 事件, 但是firefox不支持,所以firefox使用css来控制

<body onselectstart = "return false" style = { -moz-user-select : none }></body>

另一种思路 => 清空选中

window.getSelection ? window.getSelection().removeAllRanges() : document.selection.e


举报

相关推荐

0 条评论