If you are setting the icon with the <i> tag. You shouldn’t change the textContent property, but the innerHTML.
The difference is that the textContent does not parse the HTML tags to elements.
With the textContent you are setting the text of the element, but with the innerHTML you are setting the HTML content.

Please see the demo below:

Here is the modified example: https://codepen.io/svetoslavjqwidgets/pen/MWqqpKR

Best Regards,
Svetoslav Borislavov

Smart UI Team