Change the href
attribute of the desired anchor element
$("a").prop("href", "http://www.google.com/")
I have create jsfiddle for you, please take a look.
HTML:
<div id="links">
<a data-curent-ext="com" href="http://www.google.com">google.com</a>
<a data-curent-ext="com" href="http://www.yahoo.com">yahoo.com</a>
<a data-curent-ext="com" href="http://www.bingo.com">bingo.com</a>
</div>
<br/>
<div class="triggers">
<a class="change" data-url-ext="rs" href="#">rs</a>
<a class="change" data-url-ext="bla" href="#">bla</a>
</div>
Jquery:
$('.triggers').on('click', '.change', function () {
var urlExt = $(this).data('url-ext');
$('#links').find('a').each(function () {
var self = $(this);
var cExt = self.attr("data-curent-ext");
self.attr({'href': function() {
return this.href.replace(cExt, urlExt);
}, "data-curent-ext": urlExt}).text(function( index ) {
return this.text.replace(cExt, urlExt);
});
});
});