<a id="exampleLink" href="https://example.com">Example Link</a>
<p class="text"></p>HTMLAnchorElement: text property / notebook
HTMLAnchorElement: text property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
#exampleLink {
font-size: 1.5rem;
}const anchorElement = document.getElementById("exampleLink");
const pTag = document.querySelector(".text");
pTag.textContent = `Text property: ${anchorElement.text}`;