Replace specific anchor text

by aaronk85

HTML

<a href="#n279">Leagues</a>
<a href="#sp">sp</a>

<div class="regionHeading"><a class="regionname" href="select_node_frame.cgi?cID=279&amp;p=1" name="n279">Leagues:</a> </div>

<div class="regionHeading"><a class="regionname" href="select_node_frame.cgi?cID=300&amp;p=1" name="n300">Athletics:</a> </div>

JavaScript

$(document).ready(function() {
    $('a').each(function() {
        if (this.href == 'http://www.sportingpulse.com/#n279') {
            $(this).replaceWith("<a href='#n279'>Australian Football Leagues</a>");
        }
        else if (this.href == 'http://www.sportingpulse.com/select_node_frame.cgi?cID=279&p=1') {
            $(this).replaceWith("<a href='select_node_frame.cgi?cID=279&amp;p=1'>Australian Football Leagues</a>");
        }
        else {}
    });
    });