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:
– with enough funding I plan to develop a website of some sort with a new developer experience!
For your reference, check this out:
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!
Nguồn: https://dinhk.net/
Xem thêm bài viết: https://dinhk.net/category/giai-tri/
10 Responses
Can you send a value like this 18.4983552,-77.8715136 to an input tag?
Great explanation, keep the good work.
P.S: I subscribed and liked the video
very good ❤
My code is not working how can I get a help from you. Please help me sir
What keyboard/switches are you using? Sounds good.
thanks you've been so helpfull, you have no idea
Thank you for explaining it so well.
Thank you SO MUCH !!!!!!!!!!!! 😭😭😭
Great video. Did not know about the security aspect of innerHtml.
The interesting part is the subtle difference between textContent and innerText.
Could you make a video on that ? …