开发者

Adding to an unordered list in JQuery Mobile

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜