JSFiddle - React, Tailwind, and code Playground
HTML
<br />
<div id='container'>
<div id='commentBox' contentEditable>
<p>line 1</p>
<p>line 2</p>
</div>
<button id='saveButton'>SAVE</button>
</div>
CSS
div#container {
margin: 0 auto;
width: 80%;
}
div#commentBox {
border: 1px solid #eee;
padding: 4px;
}
JavaScript
var Comments = 'div#commentBox';
var saveButton = 'button#saveButton';
$(saveButton).click(function() {
var updatedHTML = $(Comments).html();
var updatedText = $(Comments).text().replace(/\n/g,"<br />");
console.log('html is: ' + updatedHTML);
console.log('text is: ' + updatedText);
/*$.ajax {
// POST request here...
}*/
});