Why is .disableSelection() deprecated?

You can use CSS to accomplish this in most browsers: http://jsfiddle.net/fQthQ/

* {
   -ms-user-select: none; /* IE 10+ */
   -moz-user-select: -moz-none;
   -khtml-user-select: none;
   -webkit-user-select: none;
   user-select: none;
}

.selectable {
   -ms-user-select: auto;
   -moz-user-select: auto;
   -khtml-user-select: auto;
   -webkit-user-select: auto;
   user-select: auto;
}

Opera does not currently support this feature.

See the MDN page for more info: https://developer.mozilla.org/en-US/docs/CSS/user-select

Leave a Comment