Question on InnerText vs TextContent

Hello! I noticed that in the JavaScript courses, there are times where texts are added/updated after an event occurs (e.g. clicking a button).

I have seen both .innerText and .textContent used for adding/updating the text within HTML elements.

How do we determine which one to use in cases of updating texts? Thanks~

Hi! I’m learning the same topic right now :slightly_smiling_face: I found this article helpful and hope you will too:

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.