Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

contenteditable paste plain text

editor.addEventListener("paste", function(e) {
    // cancel paste
    e.preventDefault();

    // get text representation of clipboard
    var text = (e.originalEvent || e).clipboardData.getData('text/plain');

    // insert text manually
    document.execCommand("insertHTML", false, text);
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #contenteditable #paste #plain #text
ADD COMMENT
Topic
Name
3+1 =