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');
精彩评论