I've encountered this issue before, but I'm still struggling to resolve it. When adding dynamic content to a page (specifically a list-view), the CSS seems to disappear once the content is added. I've tried using the trigger("create") function as suggested, but the CSS styles still don't apply.
$('#MyClubsListDiv').append('<ul id=\"MyClubsList\" data-role=\"listview\"></ul>').trigger("create");
for (var i=0; i<MyClubsReply.length; i++)
{
addClub('#MyClubsList',MyClubsReply[i].Name,MyClubsReply[i].LogoImg,MyClubsReply[i].LastUpdate);
$('#MyClubsListDiv').trigger("create");
}
function addClub(section,clubName,logoFile,LastUpdate)
{
$(section).append('<li class=\"ClubListItem\">' +
'<a href=\"#ClubPage\" data-transition=\"slide\">' +
'<img src=\"' + PiccoloServer + 'ClubLogos/' + logoFile + '\" class=\"listview-logo-thumb\" />' +
'<div class=\"ClubListContent\">' +
'<h1 class=\"ClubListH1\">' + clubName + '</h1>' +
'<p >20 Offers Available</p> ' +
'</div>' +
'<p class=\"ui-li-count\">25d</p>' +
'</a>' +
'</li>').trigger("create");
}
"MyClubsReply" in this case refers to a JSON object.
Can anyone pinpoint what I might be doing incorrectly? Any advice would be greatly appreciated!