How to disable text selection using jQuery?

Hello Guys ,

Your solution by JS


In jQuery 1.8, this can be done as follows:

(function($){
    $.fn.disableSelection = function() {
        return this
                 .attr('unselectable', 'on')
                 .css('user-select', 'none')
                 .on('selectstart', false);
    };

})(jQuery);


Your Solution by CSS


#csszilla
{
  -moz-user-select: none;
  -khtml-user-select: none;
  -webkit-user-select: none;
  user-select: none;
}

Comments

Popular posts from this blog

50 Beautiful Color Palettes for Your Next Web Project

right side toggle by js, toggle from ride side by js, toggle js for website, form toggle from right side js, js for form toggle from right side