Using Textbox.io - output filter
HTML
<script src="https://s3.amazonaws.com/ephox-static-ephox-com/jsfiddle/textboxio/textboxio.js"></script>
<div id="editableDiv">
<h1> Heading </h1>
<p style="font-size:35px; color: green;"> Inline styled paragraph </p>
<p>Not inline styled paragraph </p>
</div>
<button id="getContent">Get content</button>
CSS
#editableDiv {
margin:10px 0;
height:200px;
}
JavaScript
var ed = textboxio.replace('#editableDiv');
/* function to strip inline styles from a set of elements */
var stripInlineStyles = function (elements) {
elements.forEach(function (el) {
$(el).detach();
});
};
ed.filters.selector.addOutput('p', stripInlineStyles);
$('#getContent').click( function () {
alert(ed.content.get());
});