Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

trigger JS function or Twine Macro when clicking a link

edited January 2015 in Help! with 1.x
Hullo

I want to trigger a JS function when clicking a link without changing passage e.g.


[[Do something cool|alert("You did it!")]]

What is best practice for this?

At the moment the only method I have is using raw anchors.


<a onClick="alert('It worked')">Do something cool</a>

Triggering a macro would also do. I don't mind, just want a neater solution.

Edit:
I'm using Jonah format

Comments

  • you need to state which story format you are using as answers can be different for each one

    If your using SugarCube then you could use it's click macro
Sign In or Register to comment.