How can I make certain parts of my html not selectable?
I have some absolutely positioned divs that keep getting selected if a user tries to select the content of my page.
Is there a way to make it so certain elements (such as those divs) aren’t selectable?
EDIT: The main issue is when someone copies these absolute div’s and then pastes them into the rich text editor on my site, the rich text editor breaks on IE.
If you want to just hide selection rectangle, you can use
and it’s counterpart for Gecko
If you want to help your users select right text to copy to clipboard, you can move the element away. Usually browsers retain order of elements as they are defined in HTML when selecting. While it is not perfect solution, you can place the element’s code in HTML either at the very beginning or very end of
<body>tag. This way, if user selects something in the middle of the page, the element will be too “far away” to interfere.