Which property is used to change the text content of a selected element?

  • innerText
  • textContent
  • innerHTML
  • text
The textContent property is used to change the text content of a selected element. It sets or returns the text content of an element and ensures that any HTML tags are treated as plain text. The other options do not handle text content in the same way.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *