Join the Webstudio community

Updated 7 months ago

Adding functionality to button

At a glance

The community member is trying to transform a div on the click of a button, and wants to know how to add onclick functionality or change the token of another element on click of a button in the editor. The comments suggest using HTML embed to add a custom script, but this cannot be used to add/delete tokens. The community members also discuss using hover and focus events, as well as custom JavaScript for click functionality, but there is no explicitly marked answer.

Hi. I'm trying to transform a div on the click of a button. How do i do this? How do i add onclick functionality, or change the token of another element on click of a button it in the editor?
S
O
8 comments
Also, I can't see any documentation on buttons anywhere online? Has this not been created?
Hi, using html embed to add a custom script
Can't add/delete tokens this way though.
Can't you tell exactly your use case?
This is from a prototype made in figma of what I'm trying to do.
You can probably use hover and focus events for this
So it's just css states
Otherwise click with custom js
Add a reply
Sign up and join the conversation on Discord