get href attribute javascript

JavaScript
//Selects all links which have href='http://google.com'
document.querySelectorAll("a[href='http://google.com']");document.getElementById("link")[0].getAttribute("href");
Source

Also in JavaScript: