ContentEditable DIV - disabling drag and drop

Posted by sonofdelphi on Stack Overflow See other posts from Stack Overflow or by sonofdelphi
Published on 2010-06-13T17:14:46Z Indexed on 2010/06/13 17:22 UTC
Read the original article Hit count: 627

Filed under:
|
|

Is it possible to disable the drag-and-drop functionality on elements which have the contentEditable attribute set to true.

I have the following HTML page.

<!DOCTYPE html>
<html><meta charset="utf-8"><head><title>ContentEditable</title></head>
<body>
    <div contenteditable="true">This is editable content</div>
    <span>This is not editable content</span>
    <img src="bookmark.png" title="Click to do foo" onclick= "foo()">
    </span>
</body>
</html>

The main problem I'm facing is that it is possible to drag and drop the image into the DIV and it gets copied (along with the title and the click handler)

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about html5