yaip
Posts: 0
Joined: Sun Dec 09, 2012 2:07 am

How to change the color property of a button

I put my page in debug. Now I am not sure if the bug is in my code or at your end.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to change the color property of a button

Try the click but with a simple:

alert (...);

see if you need to click it twice.

yaip
Posts: 0
Joined: Sun Dec 09, 2012 2:07 am

How to change the color property of a button

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?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to change the color property of a button

Yes. In your code above you attach the click event on the actual component so this is available.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to change the color property of a button

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

Return to “Issues”