What are good use cases for using .innerHTML?


#1

Question

What are good use cases for using .innerHTML?

Answer

We can use .innerHTML when we want to completely replace the contents of an element including any of it’s children nodes. We can also use .innerHTML when we want to simply get the content from inside an HTML element and potentially use it later in our web page/application.