Dynamically creating Listviews and dynamically adding items to listview is one of the most frequently asked issue in jQueryMobile forums.
All dynamically added items needs to be enhanced to apply JQM styles.
Here is the rules.
- Use Listview(“refresh”) for adding new item(<LI>) to an existing Listview(<UL>).
- Use $(containerSelector).append($newlistmarkup).trigger(“create”) for adding a new Listview(UL).
Below code provides sample of
- Dynamically add items to an existing listview.
- Dynamically add a listview and then add items to it.
A Full Demo can be seen here