Home › Forums › JavaScript › Remove mouse highlighting ability on a page? › Re: Remove mouse highlighting ability on a page?
December 21, 2010 at 2:06 am
#69345
jamygolden
Member
-moz-user-select: none;
-webkit-user-select: none;
user-select: none;
Gecko and Webkit are the only ones supporting it atm though.
Or
You could put an invisible div ontop of the text. Assuming this doesn’t have to be done in dynamic places.
Edit: Also, I came across this javascript example:
$.fn.disableSelection = function() {
$(this).attr('unselectable', 'on')
.css('-moz-user-select', 'none')
.each(function() {
this.onselectstart = function() { return false; };
});
};
$(document).ready(function(){
$('p').disableSelection();
});