In IE, you need the unselectable attribute in HTML:
<div id="foo" unselectable="on">...</div>
... or install it using JavaScript:
document.getElementById("foo").setAttribute("unselectable", "on");
The thing you need to know about is that non-selectivity is not inherited by children of a non-selectable element. This means that you need to either put the attribute in the start tag of each element inside the <div> , or use JavaScript to do this recursively for the descendants of the element:
function makeUnselectable(node) { if (node.nodeType == 1) { node.setAttribute("unselectable", "on"); } var child = node.firstChild; while (child) { makeUnselectable(child); child = child.nextSibling; } } makeUnselectable(document.getElementById("foo"));
Tim down
source share