How to change icon with javascript (user clicks button - icon changes)?

I have a button with the “volume-up” icon, and I want users to be able to click said button and have the “volume-off” icon appear.

I had this working perfectly with X theme by adding and removing class:

document.getElementById(‘volume’).firstChild.classList.add(‘x-icon-volume-off’);
document.getElementById(‘volume’).firstChild.classList.remove(‘x-icon-volume-up’);

But the Pro Theme doesn’t seem to use these classes anymore or so it appears.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.