【发布时间】: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'.
对此的任何帮助将不胜感激。
谢谢。
【问题讨论】: