Replacing &ndash; character using Javascript or JQuery
<p>I need to replace the dash in a title on by site with a span tag and line break to break to title over two lines.
Unfortunately I don't have access to do this in the PHP :(</p>

<p>The below statement seems to do this. Although with bugs as it's making this change to the character throughout the page.</p>

<pre><code>document.body.innerHTML = document.body.innerHTML.replace(/\u2013/g, "&lt;/span&gt;&lt;br /&gt;&lt;span&gt;");
</code></pre>

<p>The jQuery solution I tried below, works but sometimes the element would have a visibility hidden on the element!</p>

<pre><code>$("#events h3 a").each(function() {
  $(this).html($(this).html().replace(/\u2013/g,"&lt;/span&gt;&lt;br /&gt;&lt;span&gt;"));
});
</code></pre>

<p>Ideally I would like to use the pure JavaScript version above but need help navigating to the Events Link.</p>

<pre><code>#events h3 a
</code></pre>

<p>Thanks anybody who can help, I have hunted for a solution everywhere.</p>

<p>This is an example of the page structure. And explains why the span close and start are back to front in the code excerpt. This is so each half can be styled when on separate lines.</p>

<pre><code>&lt;ul id="events"&gt;
    &lt;li&gt;
        &lt;h3&gt;
            &lt;a href="http://example.com"&gt;
                &lt;span&gt;First Events Title - On Every Sunday&lt;/span&gt;
            &lt;/a&gt;
        &lt;/h3&gt;
    &lt;/li&gt;
    &lt;li&gt;
        &lt;h3&gt;
            &lt;a href="http://example.com"&gt;
                &lt;span&gt;Second Events Title - On Every Monday&lt;/span&gt;
            &lt;/a&gt;
        &lt;/h3&gt;
  &lt;/li&gt;
&lt;/ul&gt;
</code></pre>
