I want to remove rich text from my contenteditable div keep only newline or br tags when paste something from clipboard.
I'm trying but its doesn't work http://jsfiddle.net/marco83/zkf5jkqu/
<div id="editableDiv" contentEditable="true" style="min-height: 200px; border: solid 1px #0099FF;"></div>
<input type="button" value="remove" onclick="strip();">
<script>
function strip() {
var mydiv = document.getElementById("editableDiv");
var str = mydiv.innerHTML;
str = str.replace(/<br>/gi, "\n");
str = str.replace(/<(?:.|\s)*?>/g, "");
mydiv.innerHTML = str;
}
</script>
I copy the text from this page http://www.jacklmoore.com/autosize/
I know it doesn't have any <br> tag the text. but how can i do like Twitter does like this? Thanks.
