I have a code snippet here that is designed to style a button when it is clicked and then maintain the style even after the click for a more aesthetically pleasing look. I'm wondering if there might be another approach to achieve this effect? Thanks!
// Clicked button receives enhanced styling
document.querySelectorAll('button[type="button"]').forEach(button => {
button.addEventListener("click",event => {
// Apply styling
event.target.style["boxShadow"] = "0 0 2px 3px rgba(250,189,22,0.95), inset 0 0 4px 0 rgba(250,195,35,1)";
event.target.style.borderRadius = "0.4rem";
event.target.style.transitionDuration = "45ms";
event.target.style.transform = "scale(0.98)";
setTimeout(() => {
// Remove the clicked styling
event.target.style.removeProperty("box-shadow");
event.target.style.removeProperty('border-radius');
event.target.style.removeProperty('transition-duration');
event.target.style.removeProperty('transform');
}, 110);
});
});