Created
September 12, 2013 07:20
-
-
Save mojaray2k/6533949 to your computer and use it in GitHub Desktop.
In certain situations, you might want to prevent text on the page from being selectable. This is useful when
building interfaces that can be dragged or reordered, as you don't want users to select text from the page by
accident. Here is a snippet that does this and works in all browsers.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('p.descr').attr('unselectable','on') | |
.css('user-select','none') | |
.on('select-start', false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment