get href value of anchor tag in javascript code example Example: get href attribute javascript document.getElementById("link")[0].getAttribute("href");