$(function(){
$.extend($.fn.disableTextSelect = function() {
return this.each(function(){
if($.browser.mozilla){
$(this).css('MozUserSelect','none');
}else if($.browser.msie){
$(this).bind('selectstart',function(){return false;});
}else{
$(this).mousedown(function(){return false;});
}
});
});
$('#box').disableTextSelect();
});
You can also do this with CSS:
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;