To be more precise and make it work only for a particular anchor element
$("body").ready(function() {
$("ul >li >a:contains("google").attr("href", "http://www.stackoverflow.com/")
})
solved How to change the href through javascript or jquery? [duplicate]