Adding Class on Click to Interaction

Just wondering if I’ve missed something, but is there a way to addClass on Click using the new Interactions 2.0? Looks like all posts about this were pre-IX 2.0, so just wondering if it’s been added in since and I haven’t found it.

Thanks!

Did you find a solution to your project?

I think not. See this wishlist idea
wishlist -} Add / remove classes via Interactions:
https://wishlist.webflow.com/ideas/WEBFLOW-I-214

For now you can use this (custom code)
toggleClass

2 Likes

Not sure if this has been added yet, but I also wanted to throw it out there that you WILL need to wrap that code in <script>[code here]</script> tags.

SO!

<script>
$("#your_button_id").click(function(){
  $("#element_to_toggle_id").toggleClass("class_to_toggle");
});
</script>

Should also be noted, you can also just .addClass or .removeClass as well.

Hey, I got to do the same thing using this: Finsweet Class Adder Webflow Interactions Tool