Gabriel Mendez Gabriel Mendez - 25 days ago 10x
Android Question

How to change the jquery mobile flip switch state from code

I have some jQuery Mobile flip toggle switches on my Android/iPad application, and I need to
change their states (on/off) dynamically, using JavaScript.
I was looking for a solution here, (Change value of flip toggle dynamically with jQuery Mobile) and I tried several ways (

...) but it seems the control is not working at all.

Is there a solution for this issue? How can I do to change the flip switch state from code?


I've examined the page you posted and I confirmed that the solution:


does indeed work. Make sure that 'selector' is referencing your select element, and that 'value' is a value you defined on the option element you wish to enable.

I confirmed this by visiting, then with firebug's console entering the line:


It switched the second slider displayed on the page from yes to no.