Answers for "The behavior that Selection.addRange() merges existing Range and the specified Range was removed."

0

The behavior that Selection.addRange() merges existing Range and the specified Range was removed.

#make sure to call selection.removeAllRanges(), then call selection.addRange(range)
selection = window.getSelection();    
range = document.createRange();
range.selectNodeContents(elem);
selection.removeAllRanges();         
selection.addRange(range);
Posted by: Guest on October-09-2021

Code answers related to "The behavior that Selection.addRange() merges existing Range and the specified Range was removed."

Code answers related to "Javascript"

Browse Popular Code Answers by Language