Page 1 of 1

Setting Toggle Switch with Javascript

Posted: Mon Apr 28, 2014 5:22 pm
by Ray Phelan

Hi.

I am trying to set the value of a toggle switch with javascript.
It does not work.

I'm using this:

My toggle switch is called "toggle_switch"

On "Page Show"
Apperyio('toggle_switch').val('on');
Apperyio('toggle_switch').slider( "refresh" );

Does not work

I placed a button on the screen to test it with the same code "On Click"
Also does not work.

The tutorials are not correct in the Docs. Some of the do not work.

How do I do this?


Setting Toggle Switch with Javascript

Posted: Mon Apr 28, 2014 7:20 pm
by Maryna Brodina

Hello!

Please take a look here http://api.jquerymobile.com/flipswitc...
You need the following code preApperyio("tog").val("off");
Apperyio("tog").flipswitch("refresh");/pre


Setting Toggle Switch with Javascript

Posted: Tue Apr 29, 2014 12:20 pm
by Ray Phelan

Thank you Maryna! :)


Setting Toggle Switch with Javascript

Posted: Wed Jun 04, 2014 3:41 pm
by ewan

hi,

Nice solution. One comment:
http://devcenter.appery.io/documentat...

appears to suggest that:
Appery('toggle').val('off');
Appery('toggle').slider( "refresh" );

will achieve this. Since
http://devcenter.appery.io/documentat...

appears to contain an incorrect example, it would be great if it could be updated in line with this solution

ewan