Change the first header tag in the document (<h2>,<h3>..<h6>) to <h1>
<p>If <code>&lt;h1&gt;</code> doesn't exist, find the first header tag in the document (one of either <code>&lt;h2&gt;</code> through <code>&lt;h6&gt;</code>), and if the tags text equals the title text, change the element to <code>&lt;h1 class="heading1"&gt;</code>.</p>

<p>This works as far as I can tell, but there has to be a more efficient way to write it.</p>

<pre><code>var titleText = $('title').html()
var hOne = $('h1:eq(0)');
var hTwo = $('h2:eq(0)');
var hThree = $('h3:eq(0)');
var hFour = $('h4:eq(0)');
if (hOne.html() == titleText)
{
    return;
}
else if (hTwo.html() == titleText)
{
    var hTwoText = hTwo.html();
    hTwo.replaceWith(function () {
        return '&lt;h1 class="heading1"&gt;' + hTwoText + "&lt;/h1&gt;";
    });
}
else if (hThree.html() == titleText)
{
    var hThreeText = hThree.html();
    hThree.replaceWith(function () {
        return '&lt;h1 class="heading1"&gt;' + hThreeText + "&lt;/h1&gt;";
    });
}

else if (hFour.html() == titleText)
{
    var hFourText = hFour.html();
    hFour.replaceWith(function () {
        return '&lt;h1 class="heading1"&gt;' + hFourText + "&lt;/h1&gt;";
    });
}
</code></pre>
