Page 2 of 2

How to change the color property of a button

Posted: Mon Dec 10, 2012 10:17 pm
by yaip

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


How to change the color property of a button

Posted: Tue Dec 11, 2012 2:33 am
by maxkatz

Try the click but with a simple:

alert (...);

see if you need to click it twice.


How to change the color property of a button

Posted: Wed Dec 12, 2012 6:42 pm
by yaip

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?


How to change the color property of a button

Posted: Wed Dec 12, 2012 7:35 pm
by maxkatz

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


How to change the color property of a button

Posted: Thu Dec 13, 2012 11:23 pm
by maxkatz

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