jQuery Mobile does not apply styles after dynamically adding content
Solution 1:
Try calling .trigger("create")
on the element with the new content.
According to the jQuery Mobile docs, "The create
event is suited for enhancing raw markup that contains one or more widgets."
EDIT: As of jQuery Mobile 1.4, .trigger('create')
is deprecated, and you should use .enhanceWithin()
instead. (Thanks to John Mc for the heads-up.)
Solution 2:
This worked for me for the list view
$('ul').listview('refresh');
Also you can refresh the collapsible
$('#element').collapsibleset('refresh')