Updating A List In JQuery Mobile

Are you using jQuery Mobile and trying to manipulate a listview?

I was trying to do this earlier, adding new <li> elements to a <ul data-role="listview">. However, none of the new elements were looking correct, or having the right styles applied.

The solution is to tell jQuery Mobile to refresh the list and apply the styles.

If your <ul> list has an id of wibble you could use the following…

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

Your list will now have the correct styling applied.