ultimix
jquery.disable.text.select.js
Go to the documentation of this file.
1 
19 (function($) {
20  if ($.browser.mozilla) {
21  $.fn.disableTextSelect = function() {
22  return this.each(function() {
23  $(this).css({
24  'MozUserSelect' : 'none'
25  });
26  });
27  };
28  $.fn.enableTextSelect = function() {
29  return this.each(function() {
30  $(this).css({
31  'MozUserSelect' : ''
32  });
33  });
34  };
35  } else if ($.browser.msie) {
36  $.fn.disableTextSelect = function() {
37  return this.each(function() {
38  $(this).bind('selectstart.disableTextSelect', function() {
39  return false;
40  });
41  });
42  };
43  $.fn.enableTextSelect = function() {
44  return this.each(function() {
45  $(this).unbind('selectstart.disableTextSelect');
46  });
47  };
48  } else {
49  $.fn.disableTextSelect = function() {
50  return this.each(function() {
51  $(this).bind('mousedown.disableTextSelect', function() {
52  return false;
53  });
54  });
55  };
56  $.fn.enableTextSelect = function() {
57  return this.each(function() {
58  $(this).unbind('mousedown.disableTextSelect');
59  });
60  };
61  }
62 })(jQuery);