Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change value of flip toggle dynamically with jQuery Mobile

I'm working with jQuery Mobile, and I save some settings in a cookie. When the settings page is reloaded, I read the cookie to set all the values. I'm having trouble setting the flip toggle switch. Most elements just have to trigger the keyup or changed events, but I'm not sure how the flip toggles gets its value from the select box. Any ideas?

like image 463
Markus T. Avatar asked Nov 24 '10 05:11

Markus T.


1 Answers

After you change the value of the switch you have to refresh it for the animation to toggle:

$('#Switch2').val('on').slider("refresh");
like image 113
Chris D. Avatar answered Sep 27 '22 17:09

Chris D.