diff --git a/files/en-us/web/api/htmlanchorelement/text/index.md b/files/en-us/web/api/htmlanchorelement/text/index.md new file mode 100644 index 000000000000000..eeb791128821e54 --- /dev/null +++ b/files/en-us/web/api/htmlanchorelement/text/index.md @@ -0,0 +1,52 @@ +--- +title: "HTMLAnchorElement: text property" +short-title: text +slug: Web/API/HTMLAnchorElement/text +page-type: web-api-instance-property +browser-compat: api.HTMLAnchorElement.text +--- + +{{ApiRef("HTML DOM")}} + +The **`text`** property of the {{domxref("HTMLAnchorElement")}} represents the text inside the the element. +This property represents the same information as {{domxref("Node.textContent")}}. + +## Value + +A string. + +## Example + +```html +Example Link +

+``` + +```css +#exampleLink { + font-size: 1.5rem; +} +``` + +```js +const anchorElement = document.getElementById("exampleLink"); +const pTag = document.querySelector(".text"); +pTag.textContent = `Text property: ${anchorElement.text}`; +``` + +### Result + +{{EmbedLiveSample("Example",100,100)}} + +## Specifications + +{{Specifications}} + +## Browser compatibility + +{{Compat}} + +## See also + +- {{domxref("HTMLScriptElement.text")}} property +- {{domxref("HTMLOptionElement.text")}} property