I put my page in debug. Now I am not sure if the bug is in my code or at your end.
I put my page in debug. Now I am not sure if the bug is in my code or at your end.
Try the click but with a simple:
alert (...);
see if you need to click it twice.
I'm trying to run an external JavaScript called chgColor. So I've moved my code there and I invoke it on the click event (runJavascript chgColor();) but nothing's happening. What am I doing wrong? Do I need to pass 'this' or is it implied?
Yes. In your code above you attach the click event on the actual component so this is available.
You already define a click event (in the builder), you don't need another click event via on().. just run this:
code
var dotoggle = Tiggzi('btn').attr("dotoggle");
if (dotoggle == "1") {
Tiggzi('btn').css('background', 'green');
Tiggzi('btn').attr("dotoggle", "0");
} else {
Tiggzi('btn').css('background', 'red');
Tiggzi('btn').attr("dotoggle", "1");
}
/code