Alexandre Bourdin
Alexandre Bourdin

Reputation: 835

How to regenerate jQuery Mobile style after Ajax request?

I'd like to apply autogenerated jQuery Mobile style (classes jQuery Mobile applies on page loading) after additionnal content loading via Ajax.

I load some content via Ajax which is parsed and organised into a <ul>, but the style jQuery usually applies on page loading isn't applied again on the Ajax loaded content.

Upvotes: 15

Views: 9331

Answers (2)

Samson
Samson

Reputation: 41

I was having troubles with this refresh method as well, got it working after a bit more searching by removing 'refresh', ie :

$('#yourlist').listview();

Found with explanation at http://forum.jquery.com/topic/wish-listview-refresh-would-go-away. Works ok in 1.1.1

Upvotes: 2

Cyril
Cyril

Reputation: 1649

Assuming your ul is a jquery-mobile "listview", try to refresh the entire list by using :

$('#yourlist').listview('refresh');

jQuery Mobile doucmentation http://jquerymobile.com/demos/1.0a2/#docs/forms/plugin-eventsmethods.html

Upvotes: 14

Related Questions