get href from a in js code example Example: get href attribute javascript document.getElementById("link")[0].getAttribute("href");