So I have a layer in Framer with an HTML property. In the HTML I have a link. I want that link to trigger a function in Framer when it is clicked. Does anyone know how to do this?
I think one way to do it is to give your <a> a class like <a class="link">, then get a reference to that class in the dom:`link = document.getElementsByClassName('link')`and attach onclick to it:`Events.wrap(link).on Events.Click, (e) -> print e.target`
But I think you could use TextLayer for this though? so you don't have to go around Framer like this
edit: use Framer's Events.wrap()
Thanks for your answer - it makes sense but alas, it didn't work.
I'm not familiar with the Events.wrap(). I know you can wrap() scroll content but that's all I know of.
I can easily make the whole Text layer selectable but I want just a word, mid paragraph.
Got it! Add an ID then use framer's querySelector to bind it to an object. Note, the parent layer must be receiving events. If I remove the onClick from the layer that contains the HTML it does not "find" the HTML anchor.