I have a simple script set up to run when text in a passage is clicked. This is working fine for the most part, except on passages where I've used the << linkreplace >> macro.
I'm thinking it has something to do with the way the << linkreplace >> generates the text, since I tested and the JS function itself is working fine, and a console inspection shows that the <span> class is successfully being added to the text.
I'm just a bit stumped on why it won't work, any insight or help would be greatly appreciated!
Here's a simple version of the code I'm using:
I'll have a <<linkreplace "cupcake">><span class="add">slice of key lime pie</span><</linkreplace>>, please.
<style>
.red {
color: red;
}
</style>
<script>
$('.add').on( "click", function() {
$(".add").addClass("red");
});
</script>