I’ve started using Kirby quite recently and I’m very new to all of this.
Here is a simplified example of the situation i’m in:
I’m able to use informations like <?= $image->title()?>"> quite simply in my html.
But now, i’m making a script that will react when you hover an image.
So I’d like the user to be able to hover any image and be alerted of that image title.
I think it would make more sense to store this information in a data attribute in your HTML you can then reference in your script. That way, your JS can live in a script file. If you need more data, calling a route or content representation could be options
And there’s the general concept about “when what is executed where and by whom”. I wouldn’t know a specific authoritative source online for that.
Maybe we can help you better with more specific questions.