I'm currently working on a WYSIWYG text editor but having a little trouble with one element. Whenever I copy and paste text from a site it will paste with the background color too. I want it so that when it pastes the text, the background color is removed.
Currently I've got a div that can be edited:
<div id="editor" class="comment-section" contenteditable="true" spellcheck="false" tabindex="0"></div>
and then using jQuery I am trying to remove the background color of all children within the div as when I paste text it adds a span to the div:
$('#editor').on('paste', function(e) {
$(this).children().attr('background-color', 'transparent');
});
But this seems to set the background color of the previous pasted text to transparent but still it doesn't actually remove the background.