toggle text and background color
We are changing the style, text color and background, of the toggle. With .ui-btn-down-b we can change these values when te toggle is "Off", but, how can we do to change these values in the status "On" of the toggle?
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
We are changing the style, text color and background, of the toggle. With .ui-btn-down-b we can change these values when te toggle is "Off", but, how can we do to change these values in the status "On" of the toggle?
I'm not sure I fully understand the question.. but you could check the current status of the component and based on that apply the correct style.
We set in the "value change" event for the toggle:
var dotoggle = Appery('toggleNoticias').attr("dotoggle");
if (dotoggle == "1") {
Appery('toggleNoticias').css('color', 'green');
Appery('toggleNoticias').attr("dotoggle", "0");
} else {
Appery('toggleNoticias').css('color', 'red');
Appery('toggleNoticias').attr("dotoggle", "1");
}
but the color of the text don't change
Make sure your selector is correct:
Appery('toggleNoticias')
and you are applying styles to the right element.
Appery(..) is just a shortcut function: http://docs.appery.io/javascript-api/.