I want to replace all whitespaces to
<div class="red-c"><p>Hel lo <span style="background-color: rgb(204, 193, 217);">h el lo</span> <span style="font-size: 18px;">h<span style="background-color: rgb(127, 127, 127);">e ll</span>o</span> h ello
</p></div>
with the result
<div class="red-c"><p>Hel lo <span style="background-color: rgb(204, 193, 217);">h el lo</span> <span style="font-size: 18px;">h<span style="background-color: rgb(127, 127, 127);">e ll</span>o</span> h ello
</p></div>
I’ve tried
$(".red-c").html().split(" ").join(" "))
but this also replaces the white spaces in the html tags.