This question already has an answer here:
So, while playing with scrollbars and stuff in HTML5, I'm starting to notice an annoying trend. If I have text near my element that's being dragged (say, a scrub bar for a video, scroll bar, anything a user would click and drag), nearby text will get selected, as if I'm not using a control, just dragging over the page.
This is terribly annoying, and I can't seem to find the right string to search for on google to figure out if it's possible to make certain elements "unselectable".
Anyone know how to do this?
Awesome! I'm embarrassed that I've made it this far without knowing that.
Just know that the -moz one only makes the appearance of selection invisible, it doesn't disable it functionally. developer.mozilla.org/en/CSS/-moz-user-select
There's also -o-user-select for Opera and the unselectable expando property for IE. See my answer for full details.
Marcel If it wasn't before, it is now (as I'd expect...). Just saying.
I just tried it out in a few browsers I have installed for Windows (Fx 3.6 and 13, Chrome 20b, Opera and IE10). Firefox 3.6 seemed to work the best between highlighting the specific element, highlighting sibling elements and content copied to the clipoard with this method. The latest stable Opera still doesn't support blocking any of this and I couldn't get anything to work in IE10, even setting the unselectable="on" attribute.
You're right when IE9 is in standards mode (in compatibility modes the unselectable property works fine). I've now updated five of my answers involving unselectable (apparently that's the maximum number of edits allowed to your own posts in a day. I've no idea why). Odd that one of your edits was approved and an identical one rejected.
Some background as to why this change has happened in IE 9: msdn.microsoft.com/en-us/library/ie/gg622931%28v=vs.85%29.aspx