vendredi 26 février 2021

DOM manipulating HTML - icon nested inside button tag

I'm building a todo list right now and wondering about the usage of innerHTML. If I want an icon inside of a button tag:

btn.innerHTML = '<i class="fas fa-times fa-lg"></i>';

which is <button><i class="fas fa-times fa-lg"></i></button> am I right?

What is the difference between the above and below?

btn.innerHTML += '<i class="fas fa-times fa-lg"></i>';



Aucun commentaire:

Enregistrer un commentaire