I'm kinda stuck on this. I have a webapp where I use a simple jQuery plugin:
$.extend($.fn.disableTextSelect = function() { return this.each(function(){ if($.browser.mozilla){//Firefox $(this).css('MozUserSelect','none'); }else if($.browser.msie){//IE $(this).bind('selectstart',function(){return false;}); }else if ($.browser.webkit) { // chrome, webkit $(this).css('webkitUserSelect','none'); this.onselectstart = function () { return false; }; }else{//Opera, etc. $(this).mousedown(function(){return false;}); } }); });
This plugin usually disables mouse text selection in all browsers. I call it the #desktop element, which is mainly the main shell:
$('#desktop').disableTextSelect();
I use this because it disables mouse text selection in all elements in #desktop. However, there are some elements in #desktop that I want to have regular text selection mode. Is there an easy way to implement code that would make an exception to a global rule?
source share