textContent vs innerHTML in the JavaScript DOM

Опубликовано: 22 Июнь 2018
на канале: dcode
56,046
972

Although commonly used interchangeably, there is a major difference between the textContent and innerHTML properties when working with Elements in JavaScript, and it's important you know what that is.

The major difference is that when using the innerHTML property, the client browser will actually interpret the content as HTML markup, and apply that change to the DOM/Window. On the other hand, the textContent property will only change the the text, preserving any HTML markup.

In this video I take you through a basic example to demonstrate that difference.

Support me on Patreon:
  / dcode   - with enough funding I plan to develop a website of some sort with a new developer experience!

For your reference, check this out:
https://developer.mozilla.org/en-US/d...
https://developer.mozilla.org/en-US/d...

Follow me on Twitter @dcode!

If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!


На этой странице сайта вы можете посмотреть видео онлайн textContent vs innerHTML in the JavaScript DOM длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь dcode 22 Июнь 2018, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 56,046 раз и оно понравилось 972 зрителям. Приятного просмотра!