Languages
[Edit]
EN

JavaScript - get link text (or content)

0 points
Created by:
AnnLen
15120

In this article, we would like to show you how to get link text using JavaScript​​​​​​.

Quick solution:

 

Practical example

Edit

In this example, we use four different methods to get the text from the a element.

Output:

References

Edit
  1. Node.textContent - Web APIs | MDN
  2. HTMLElement.innerText - Web APIs | MDN
  3. Element.innerHTML - Web APIs | MDN
  4. <a>: The Anchor element - HTML: HyperText Markup Language | MDN
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join