replace <br> tag with space javascript code example Example: javascript replace spaces with br str = str.replace(/\s/g, "<br>");