Return the text content of a link:
The result of x will be:
The text property sets or returns the text content of a link.
HTML elements often consists of both an element node and a text node, e.g., an <a> element with a text that says "Click me". Use this property if you want to get or set the "Click me" text.
The text property is supported in all major browsers.
However, when setting the text property it is only supported in Internet Explorer and Firefox.
Note: Internet Explorer 9 (and earlier versions) do not support the text property.
Return the text property:
Set the text property:
Value | Description |
---|---|
sometext | Specifies the text content of a link |
Return Value: | A String, representing the text content of the link |
---|
Change the text content of a link (only works in Internet Explorer 10+ and Firefox):