【问题标题】:JQuery Mobile: Dynamically changing data-type='horizontal' to data-type='vertical'JQuery Mobile:动态改变 data-type='horizo​​ntal' 到 data-type='vertical'
【发布时间】:2012-08-22 05:17:08
【问题描述】:

问题

我有一个 JQuery Mobile 站点,我正在尝试将字段集的属性从 data-type='horizontal' 动态更改为 data-type='vertical'。我可以让 DOM 更改,但在更改完成后,我无法让 JQM 在浏览器中刷新 DOM 的视图。

我见过很多刷新列表和单选按钮属性但不刷新字段集属性的示例。

代码

if(e.orientation == "portrait"){
    //In portrait mode, all radio buttons should be vertical.
    $('fieldset').attr('data-type', 'vertical').controlgroup('refresh');
}
else{
    //In landscape mode, all radio buttons should be horizontal.
    $('fieldset').attr('data-type', 'horizontal').controlgroup('refresh');
}
//trigger the page to recreate itself.
$('#newentry').trigger('create');

结论

我试过了:

checkboxradio('refresh') 

这给了我:

cannot call methods on checkboxradio prior to initialization; attempted to call method 'refresh'.

对此的任何帮助将不胜感激。

谢谢。

【问题讨论】:

    标签: jquery mobile


    【解决方案1】:

    致电checkboxradio(); 而不是checkboxradio('refresh'); 可能会为您初始化它,如果没有看到更多代码就不确定

    【讨论】:

      猜你喜欢
      • 2019-03-30
      • 2021-04-21
      • 2015-05-14
      • 2017-01-12
      • 2020-06-02
      • 2012-12-20
      • 2012-02-05
      • 1970-01-01
      • 2021-08-16
      相关资源
      最近更新 更多