2

I'm working with jQuery Mobile and I tried to refresh a flipswitch but when I try to do $("#flipEnabled").slider("refresh");

I get an error in the console : Uncaught Error: cannot call methods on slider prior to initialization; attempted to call method 'refresh'

Is there a solution for this issue ?

Pramod
  • 2,828
  • 6
  • 31
  • 40
Liánhuā
  • 46
  • 6

1 Answers1

2

Try the following:

if (!$('#flipSwitch').checked) {
    $('#flipSwitch').prop('checked', false);
    $('#flipSwitch').flipswitch('refresh');
}
johnnaras
  • 139
  • 10