刷新jQuery Mobile flipswitch

时间:2014-03-17 09:17:12

标签: javascript jquery jquery-mobile refresh jquery-mobile-flipswitch

我正在使用jQuery Mobile,我尝试刷新flipswitch,但是当我尝试做的时候 $("#flipEnabled").slider("refresh");

我在控制台中收到错误:Uncaught Error: cannot call methods on slider prior to initialization; attempted to call method 'refresh'

这个问题有解决方案吗?

1 个答案:

答案 0 :(得分:2)

尝试以下方法:

if (!$('#flipSwitch').checked) {
    $('#flipSwitch').prop('checked', false);
    $('#flipSwitch').flipswitch('refresh');
}
相关问题