xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

js clear copy

js clear copy

window.getSelection().empty() & window.getSelection().removeAllRanges() & document.selection.empty()

https://stackoverflow.com/questions/3169786/clear-text-selection-with-javascript

https://developer.mozilla.org/en-US/docs/Web/API/Selection

if (window.getSelection) {
  if (window.getSelection().empty) {  // Chrome
    window.getSelection().empty();
  } else if (window.getSelection().removeAllRanges) {  // Firefox
    window.getSelection().removeAllRanges();
  }
} else if (document.selection) {  // IE?
  document.selection.empty();
}
 

Chrome 79~82

https://www.cnblogs.com/xgqfrms/p/12275284.html


©xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


posted @ 2020-02-08 01:10  xgqfrms  阅读(145)  评论(1编辑  收藏  举报