阻止文字选中

方法1:
$(".xxx").bind("selectstart",function(){
return false;
}).css({
userSelect : "none"//做兼容
});// jq 1.8版本以上

方法2:
document.getElementById('div').onmousemove = function(){
 window.getSelection ? window.getSelection().removeAllRanges() : document.selection.empty();
 };

你可能感兴趣的:(阻止文字选中)