Dynamic List loses styling on second update.

Dynamic List loses styling on second update.

I have a listview that is populated dynamically - the first time it runs fine with the correct styling but when the user selects the page again it loses its styling with the list displaying as ordinary hyperlinks.

I am using jquery-1.7.1 & jquery.mobile-1.4.2

The markup looks like this,

  1. $('#container_update').empty();
  2. for(n=0; n<=5; n++){
  3.       $('#container_update').append('<li><a href="#nextPage">The value '+n+'</a></li>');
  4. };
  5. $('#container_update').listview('refresh');

Thanks,
Paul.