replace br with space javascript code example
Example 1: javascript replace with n
var str = $("#mydiv").html();
var regex = /<br\s*[\/]?>/gi;
$("#mydiv").html(str.replace(regex, "\n"));
Example 2: javascript replace spaces with br
str = str.replace(/\s/g, "<br>");