js Disable text selection when mouse moves
- 2021-07-21 07:32:57
- OfStack
This is implemented through CSS style to prohibit mouse selection function:
unselectable Prepares for IE
onselectstart is prepared for Chrome and Safari
-moz-user-select is of FF
css style:html,body{-moz-user-select: none; -khtml-user-select: none; user-select: none;}
Or
< div unselectable="on" onselectstart="return false;" style="-moz-user-select:none;" >
Style definition for mask selection:-moz-user-select attribute (only ff is supported).
Property has three property values:
1. none: With none, all the characters of child elements cannot be selected, including the characters in the input input box.
2,-moz-all: All text in the child element can be selected, but the text in the input input box cannot be selected.
3,-moz-none: All text of the child element cannot be selected, except the text in the input input box.