Disable Interaction Based on JS Conditional

I have added an interaction/animation to a button onclick.

Is there a way to disable the interaction/animation from happening based on a condition? I guess I am looking for a way, using javascript, to disable the button’s css transform property.