Any way to do this?
This is what's currently in my HTMLElement
<i class="fa fa-lightbulb-o" onclick="clickTrain(17)"> Train</i>
function clickTrain(x) { let text = "Do you wish to train this skill?"; if (confirm(text) == true) { //call a C3 function and pass the value of x which will in turn do an AJAX request. } }
Thanks
<i onclick="clickTrain(17)">Train</i> <script> function clickTrain(x) { parent.c3_callFunction("name", ["param1", "param2"]); } </script>
Develop games in your browser. Powerful, performant & highly capable.
> <i onclick="clickTrain(17)">Train</i> <script> function clickTrain(x) { parent.c3_callFunction("name", ["param1", "param2"]); } </script>
Ty!
Found one slight problem with this. It doesn't work when in debug mode.
I found that adding the event listeners via the element onclick attribute kinda is messy to work with at best. I just use eventlisteners:
const element = document.querySelector(".fa"); element.addEventListener("click", event => { console.log("Do thing here"); })
I'll give it a try. Thanks!