How to change the selected text color In Internet explorer?

前端 未结 5 881
无人及你
无人及你 2020-12-21 00:29

I have seen in many weblogs when we select text the background color of the text changes rather than usual blue. This Tech Works in Firefox and Safari, is there any method a

5条回答
  •  南方客
    南方客 (楼主)
    2020-12-21 01:03

    You could always remove it.

    
    
        
    
            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();
            }
    
        
    
    
    

提交回复
热议问题