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

What is Framer? Join the Community
Return to index
Matt Wujek
Posted Mar 06 - Read on Facebook

Any way to add attributes or data to elements? .setAttribute didn't seem to do the trick. Any ideas?

9 Comments

Spencer Schoeben

what is days?

Matt Wujek

It's an array of elements that I'm looping through. I want to set different attributes for each

Johannes Eckert

i think you should try to access the DOM element through layer.__element — and then I am not sure if setAttribute is a pure browser thing or you might need jQuery

Matt Wujek

Johannes, yeah setAttribute still doesn't work. I'll look into JQuery I suppose

Cemre Güngör

what kind of elements are in that array? are they framer layers?

Cemre Güngör

why can't you just do days[i].data = /.. ?

Matt Wujek

Cemre, that's what I needed. Thanks man

Johannes Eckert

oh THAT's what you wanted to do... I really thought you needed this to show up in the DOM. you can just add any variable or object to a layer

Matt Wujek

Awesome, thanks guys

Read the entire post on Facebook