I have a div with the attribute contentEditable set.
This allows me to have a free-form editable textarea, without the need for any form input fields: http://jsfiddl
function readContentWithBreaks(elem){
if(elem[0].innerText){
return elem[0].innerText.replace(/\n/ig,"
");
}else{
return elem.html();
}
}
Since webkit browsers support innerText I decided to detect for that swap the /n they add.
For Firefox it already gives the content with
so we can just take it as-is.