Created
September 8, 2015 20:18
-
-
Save murilobr/def47f3628d4d2ecd66b to your computer and use it in GitHub Desktop.
Prevent text selection jquery
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
$(":not(input,select,textarea)").attr('unselectable', 'on') | |
.css({'-moz-user-select':'-moz-none', | |
'-moz-user-select':'none', | |
'-o-user-select':'none', | |
'-khtml-user-select':'none', /* you could also put this in a class */ | |
'-webkit-user-select':'none',/* and add the CSS class here instead */ | |
'-ms-user-select':'none', | |
'user-select':'none' | |
}).bind('selectstart', function(){ return false; }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment