0

问候,

我正在尝试替换数据主题,但从不使用trigger.('create')或应用更改listview('refresh')

请在JSFIDDLE测试我的代码

谢谢您的帮助

这是我的代码...

HTML:

<div data-role="page" id="home">
  <div data-role="content">
    <div>
      <ul id="uuu" data-role="listview">
        <li id="kkk" data-theme="e">fail change to theme A</li>
      </ul>
    </div>
  </div>
</div>

JavaScript:

$('#uuu').append('<li data-theme="a">success change to theme A</li>');

$('#kkk').attr('data-theme', 'a');  // I need do this through ajax

// ======

$('#home').trigger('create');
$("#uuu").listview("refresh");
$("#kkk").listview("refresh"); // this is not working ?
4

1 回答 1

0

你需要刷新你的ul:

$("#uuu").listview("refresh")

更多信息:http: //jquerymobile.com/demos/1.2.0/docs/lists/lists-methods.html 1

于 2013-01-18T22:17:15.287 回答