0

問題

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'.

これに関する助けをいただければ幸いです。

ありがとう。

4

1 に答える 1

0

checkboxradio(); 代わりに呼び出すとcheckboxradio('refresh'); 初期化される可能性がありますが、コードを追加しないとわかりません

于 2012-08-21T21:17:08.307 に答える