Created
June 23, 2015 13:41
-
-
Save qizhihere/bc8112ac4afe36a85eb0 to your computer and use it in GitHub Desktop.
disable double click text selection using 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
$.fn.disableSelection = function() { | |
return this.attr('unselectable', 'on') | |
.css({ | |
'-moz-user-select': '-moz-none', | |
'-moz-user-select': 'none', | |
'-o-user-select': 'none', | |
'-khtml-user-select': 'none', | |
'-webkit-user-select': 'none', | |
'-ms-user-select': 'none', | |
'user-select': 'none' | |
}) | |
.bind('selectstart', false); | |
}; | |
// an example | |
$('tbody tr').disableSelection(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment