how to get h1 tagin javascript code example Example: get h1 text javascript var h1Text = document.querySelector("h1").innerText;