I'm trying to add a font-awesome icon to a button element but I can't figure out how to do it properly.
textContent overwrite the existing text and .createTextNode adding it as a raw text rather than an element.
const rockChosen = document.getElementById('rock');
const icon = document.createTextNode('<i class="fa-solid fa-robot"></i>');
rockChosen.appendChild(icon);
<button id="rock">
Rock
<i class="fa-solid fa-hand-back-fist"></i>
</button>
Any help would be appreciated!