Sometimes, in order to give users a better experience, you need to disable the text check feature
For example: Using the A-tag simulation button, if you can not help to use the text selection function, then double-click the text will be selected, it is very uncomfortable to use.
In most cases, you only need to use CSS styles to implement this function:
-ms-user-select:none; /*ie10+*/
6 -khtml-user-select:none;/* Early browsers */
7
8}
The user-select has four values:
None: Text cannot be selected
Text: You can select texts
All: Can be selected when all content is as a whole. If you double click or click on a child element in the context, the selected part will be the highest ancestor element that is backtracking upward with that child element.
Element: You can select text, but the selection is constrained by the bounds of the element
It is important to note that ie6-9 currently needs to be implemented via JavaScript.
Document.body.onselectstart = Document.body.ondrag = function () {2 return false;3}
CSS Forbidden Text is selected