Here’s a script for a button that will toggle that class, for example: // Select the buttonĬonst btn = document.querySelector('.btn-toggle') ītn.addEventListener('click', function(). The trick here is to swap out a class that can be a hook for changing a style anywhere on the page.