Skip to content

Instantly share code, notes, and snippets.

@tangyangzhe
Created July 31, 2013 08:53
Show Gist options
  • Save tangyangzhe/6120477 to your computer and use it in GitHub Desktop.
Save tangyangzhe/6120477 to your computer and use it in GitHub Desktop.
js取消浏览器双击选中的文本
function clearSelection() {
if(document.selection && document.selection.empty) {
document.selection.empty();
} else if(window.getSelection) {
var sel = window.getSelection();
sel.removeAllRanges();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment