开发者

Adding to an unordered list in JQuery Mobile

开发者 https://www.devze.com 2023-04-06 14:16 出处:网络
I\'m adding list items to a jquery mobile project dynamically in script: <ul id=\"list\" data-role=\"listview\" 开发者_开发技巧data-inset=\"true\" data-theme=\"c\" data-dividertheme=\"f\">

I'm adding list items to a jquery mobile project dynamically in script:

<ul id="list" data-role="listview" 开发者_开发技巧data-inset="true" data-theme="c" data-dividertheme="f">
      <li data-icon="plus"><a href="#new-thingy" data-transition="slideup">Create new thingy</a></li>
</ul>

With the following JQuery code:

$("<li><a href='#foo'>foo</a></li>").prependTo("#home-events-list");
$("#list").trigger('refresh');    

The list items are being added but they aren't 'enhanced'. What am I doing wrong?


First:

your ul has id list not home-events-list

Second:

You want

$('#list').listview('refresh');
0

精彩评论

暂无评论...
验证码 换一张
取 消