Apr 15
Disable Text Selection

  • With CSS
  •           				<div unselectable="on"></div> /* For IE */
              			
              				.classname {
              					user-select: none;
              					-moz-user-select: none; /* For Firefox */
              					-khtml-user-select: none; /* For Safari */
              					-o-user-select: none; /* For Opera */
              				}
              			
  • With Javascript
  •           				var disableTextSelection = function(element) {
              					element.unselectable = "on"; /* For IE */
              					element.style.UserSelect = "none";
              					element.style.MozUserSelect = "none"; /* For Firefox */
              					element.style.KhtmlUserSelect = "none"; /* For Safari */
              					element.style.OUserSelect = "none"; /* For Opera */
              				};
              			

Leave a Reply

You must be logged in to post a comment.