I want to replace specific texts on a page with javascript. For simplicty lets say I want to replace all letters A with the letter X. Important is that it's not going to break inline HTML.
Is there a simple way to iterate over all DOM elements and only change actual texts?
<span>hello world <a href="/">abcd</a>..</span>
should become
<span>hello world <a href="/">xbcd</a>..</span>
and not
<spxn>hello world <x href="/">xbcd</x>..</spxn>