how to get href value in html code example Example: get href attribute javascript document.getElementById("link")[0].getAttribute("href");