I'm having jQuery take some textarea content and insert it into an li.
I want it to visually retain the line breaks.
There must be a really simple way to do this...
I'm having jQuery take some textarea content and insert it into an li.
I want it to visually retain the line breaks.
There must be a really simple way to do this...
you can simply do:
textAreaContent=textAreaContent.replace(/\n/g,"<br>");
function nl2br (str, is_xhtml) {
var breakTag = (is_xhtml || typeof is_xhtml === 'undefined') ? '<br />' : '<br>';
return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1'+ breakTag +'$2');
}