Home >Web Front-end >JS Tutorial >Prevent selection while dragging
Sometimes when dragging, it will affect the dragging due to being selected, or cause some bugs. But use the following code to prevent it from being selected.
window.getSelection ? window.getSelection().removeAllRanges() : document.selection.empty();
The above is the entire content of this article. I hope that the content of this article can bring some help to everyone's study or work. I also hope to support the PHP Chinese website!
For more related articles on preventing selection when dragging, please pay attention to the PHP Chinese website!