All you need to do is adding this
$('[data-role=collapsible-set]').collapsibleset().trigger('create');
This will enhance markup of [data-role=listview]
and [data-role=collapsible-set]
for the current page (active page). You can replace $('[data-role=collapsible-set]')
with any selector.
Note(s)
Based on the fiddle in your comment, you have many mistakes.
.ready
shouldn't be used with jQuery Mobile. Also,.live
is no longer use, hence, replace.live
with.on
.Enhancement methods
refresh
,create
,pagecreate
andupdatelayout
are meant to be used for current page (active page -$.mobile.activePage
) to re-apply jQuery Mobile style. For pages created dynamically and are in DOM, there is no need to use any enhancement method - not even.page()
orpagecreate
- because pages and their contents get enhanced once placed into DOM.