I have an editable div to post a blog on a web application, when user types anything then it is working fine, but whenever we I copy a paragraph or something from another website styling of that paragraph is also copied I just want that paragraph to be copied as plaintext without any styling. How can I do that.
If this is the code
<style>
#mainDiv{
width:300px;
height:200px;
border:1px solid rgb(200, 200, 200);
}
</style>
<body>
<div contenteditable="true" id="mainDiv" onblur="func()">
</div>
<div id="anotherDiv">
</div>
</body>
<script>
function func(){
document.getElementById("anotherDiv").innerHTML=document.getElementById("mainDiv").innerHTML;
}
</script>
and I copy and paste something from another website to the first div it is being displayed in the second div with all the styling applied to it. I just want it to be displayed as plaintext.