DEV Community

Discussion on: How to do wiring in VanillaJS

Collapse
 
tarandeep_singh profile image
Tarandeep Singh • Edited

Thank you for sharing this! 😄 And yes there's no particular reason here to use innerText instead of textContent as both will work just fine. However, it's important to know the difference:

textContent gets the content of all elements, including and <style> elements. In contrast, innerText only shows “human-readable” elements. textContent returns every element in the node. In contrast, innerText is aware of styling and won’t return the text of “hidden” elements.</p>