The following markup
<div data-role="main">
<ul id="summary" data-role="listview" data-inset="true">
<li><a href="#">elem</a>
</ul>
</div>
is styled as follows on page initial load
<div data-role="main">
<ul id="summary" data-role="listview" data-inset="true" class="ui-listview ui-listview-inset ui-corner-all ui-shadow">
<li class="ui-first-child ui-last-child"><a href="#" class="ui-btn ui-btn-icon-right ui-icon-carat-r">elem</a></li>
</ul>
</div>
However, If I apply new content (li
elements) and perform the recommended .trigger("create")
var html = "";
objects.forEach(function(object)
{
html += "<li id=\"o_" + object.id + "\"><a href=\"#\">"
+ object.name
+ "</a></li>";
});
var ul = $("ul#summary");
ul.empty();
$(html).appendTo(ul).trigger("create");
styling is not applied, instead I get the following:
<div data-role="main">
<ul id="summary" data-role="listview" data-inset="true" class="ui-listview ui-listview-inset ui-corner-all ui-shadow">
<li id="o_0"><a href="#" class="ui-link">elem</a></li>
</ul>
</div>
I have also tried with .trigger("refresh")
.enhanceWithin()
.refresh()
and .refreshView()
to no avail.
How do I get Jquery-Mobile to style new dynamic content in this scenario?
- jquery-1.12.3.js
- jquery.mobile-1.4.5.js