js 取消选中的文字

用的是ConfirmBox   

当显示隐藏的时候 如果手动选中了内容 状态保留了 

var box = new ConfirmBox({
trigger: '',
title: '',
message: '',
confirmTpl: '',
cancelTpl: ''
}).after("show",function(){
document.selection && document.selection.empty && ( document.selection.empty(), 1)
|| window.getSelection && window.getSelection().removeAllRanges();
});

 

关键代码

document.selection && document.selection.empty && ( document.selection.empty(), 1)
            
|| window.getSelection && window.getSelection().removeAllRanges();

posted on 2014-05-06 16:54  ︶ㄣCamille  阅读(1159)  评论(0编辑  收藏  举报

导航