Possible Duplicate:
css rule to disable text selection highlighting
Prevent text selection after double click
Even though my events are properly prenting default actions, clicking in text and then Shift-clicking in other text is causing a selection. This is undesirable behaviour in this case, since I'm using Shift-click to multi-select these elements.
Is there something I need to do to specifically disable selection here?
EDIT: Found solution to my own problem here. Sorry for wasting people's time.
You can use the user-select property to disable text selection of an element. In web browsers, if you double-click on some text it will be selected/highlighted. This property can be used to prevent this.
To disable text selection highlighting in Google Chrome browser using CSS just set -user-select CSS property to none. And no prefix is required for Google Chrome and Opera Browsers.
Use the user-select: none; CSS rule.
Add this CSS to the section where you want to prevent text-selection:
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-o-user-select: none;
user-select: none;
Earlier versions of IE require you to add the attribute onselectstart, something like this:
<div onselectstart="return false">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With