How can I remove the br tag without breaking the formatting in jquery .I am able to remove br but it breaks my formatting. I tried such approach:
$("#realTimeContents br").remove();
<div id="realTimeContents" > dfgdfgdf
<br>
<br>
bdfsfdsg
<br>
ipiopixdgfdfh
<br>
ipiopixdgfdfh
</div>
After removing it look like this:
dfgdfgdf bdfsfdsg ipiopixdgfdfh ipiopixdgfdfh
Expected result:
dfgdfgdf
bdfsfdsg
ipiopixdgfdfh
ipiopixdgfdfh