A little help needed with a replace function
I am trying to replace a character with all headings but cannot seems to achieve it without also changing styles/href's. Here's my attempt at the function with a following example of the problem.
- $(document).ready(function() {
- ///////////////////////////////
- // find and replace headings //
- $('h1, h2, h3, h4, h5, h6').html(function (replaceos, osreplaced) {
- return osreplaced
- .replace(/o/g, '0')
- .replace(/O/g, '0');
- });
- });
<h3>Here is my string, I want t0 make changes here <span style="c0l0r: #4a1e51;">and here but n0t within the span tag</span></h3>
Anyone any ideas of how to do this?