This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Kasper Andersen
Posted Jul 07 - Read on Facebook


Is it possible to change a text (.html propperties) in a click event?

Let say i have a text layer, I use a variable to define the text like:

text1 = "Lorem Ipsum"
text2 = "Something else"

textLayer.html = text1

I want to change textLayer.html from text1 to text2. Is that possible?


Chris Camargo

It is absolutely possible. :) Have you read the docs? If so, what have you tried?

Kasper Andersen

So my guess would be something like this, which doesn't work.

Johannes Eckert

Does that work? This is really interesting. I don't think that text and image are captured inside state, but why not? Otherwise, you may need to set the text on click directly

Kasper Andersen

Chris Camargo could you nudge me in the right direction for this?

Chris Camargo

As Johannes Eckert pointed, html is not captured with state. You'll need to set the html directly utilizing the Click event. You're currently calling with your Click event, which is going to switch between the states you defined, but there are no switchable properties there (because html isn't one of them). In your click event, instead of switching states, set the html of your layer directly.

Kasper Andersen

arh that makes sense, thanks guys!

Sergio Majluf

This is an old post, but as a reference, here is a way to toggle between two text values:

Sergio Majluf

And also a version taking text from an array, so you can easily have multiple strings displayed in sequence:

Read the entire post on Facebook