1

I know this question has been asked before, but the answers simply did not work

I tried adding the jquery disable selection code here, it did not work

  jQuery.fn.extend({ 
    disableSelection : function() { 
            return this.each(function() { 
                    this.onselectstart = function() { return false; }; 
                    this.unselectable = "on"; 
                    jQuery(this).css('user-select', 'none'); 
                    jQuery(this).css('-o-user-select', 'none'); 
                    jQuery(this).css('-moz-user-select', 'none'); 
                    jQuery(this).css('-khtml-user-select', 'none'); 
                    jQuery(this).css('-webkit-user-select', 'none'); 
            }); 
    } 

});

I tried adding user-select none to it, but it didn't work

 -webkit-touch-callout: none;
 -webkit-user-select: none;
 -khtml-user-select: none;
 -moz-user-select: moz-none;
 -ms-user-select: none;
  user-select: none;

and am considering making a transparent alphabet in paint (would be a bit resource intensive)

the reason I need the text to be unhighlightable is it's a game that uses gamequery, and when the objects are dragged, the text within the div is highlighted, which makes it look really ugly.

j.gooch
  • 305
  • 1
  • 4
  • 21

1 Answers1

1

I think this is similar to How can I stop text from being selected?

helpful link:

http://chris-barr.com/2009/02/disable_text_selection_with_jquery/

Community
  • 1
  • 1
MrGoodKat
  • 58
  • 8