I thought these methods may help someone out there.
Element.addMethods({	
  disableSelection: function(element){
    if (!(element = $(element))) return;
    element.unselectable = 'on';
    if( typeof element.onselectstart != 'undefined' ){
      element.onselectstart = function(){ return false };
    } else if( typeof element.style.MozUserSelect != 'undefined' ){
      element.style.MozUserSelect = 'none';
    } else {
      element.onmousedown = function(){ return false };
    }
    if( !element.style.cursor ) element.style.cursor = 'default';
    return element
  },
  enableSelection: function(element){
    if (!(element = $(element))) return;
    element.unselectable = 'on';
    if( typeof element.onselectstart != 'undefined' ){
      element.onselectstart = null;
    } else if( typeof element.style.MozUserSelect != 'undefined' ){
      element.style.MozUserSelect = 'none';
    } else {
      element.onmousedown = null;
    }
   if( !element.style.cursor ) element.style.cursor = 'default';
   return element;
  }
});

Leave a Reply