I want to replace the multiple <br /> tags with single <br /> using JavaScript in a text.
my text like:
some text.<br />
<br />
<br />
<br />
<br />
<br />
<br />
some text
I tried this code:
document.body.innerHTML = document.body.innerHTML.replace(/<br /> <br />
<br /> <br /><br /> <br />/g,"<br />"); </script>
but it did not work .
"<br />"in a string, or<br />elements in the DOM?