Baseline Widely available
The text
property of the HTMLAnchorElement
represents the text inside the element. This property represents the same information as Node.textContent
.
A string.
Example<a id="exampleLink" href="https://example.com">Example Link</a>
<p class="text"></p>
#exampleLink {
font-size: 1.5rem;
}
const anchorElement = document.getElementById("exampleLink");
const pTag = document.querySelector(".text");
pTag.textContent = `Text property: ${anchorElement.text}`;
Result Specifications Browser compatibility See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4