I'm trying to replace all the text in a DIV, including inside children without change any html tags. In my example, I would like to change all the 'Hello' by 'Hi'. Thanks a lot.
var changes = $('div').html().replace('Hello','Hi');
$('div').html(changes);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>
<p class="hello">Hello World</p>
Hello World<br>
<span class="world">Hello World</span>
</div>