Solution to the problem that some elements cannot be rendered correctly after jquerymobile dynamically adds them:
listview: Add jq(".detail").listview("refresh");
div or others :Add .trigger( "create" );
======================================== =================================
When jqm initializes the page, it will insert jqm attributes and classes into each element according to data-xxx. After the page is initialized, if an element is dynamically inserted, the display is often ugly because there is no jqm style inserted. You can use the development tools in the browser to check this. You will find that some elements have many more classes, but the dynamically inserted element code is still the same as you wrote it.
If you want to make dynamically inserted elements have jqm styles, you can trigger the create event on the jqm object:
$('ul').listview('refresh'), and refresh will only update newly added elements. For example, the latest appended elements in the listview will be updated, and the original ones will remain unchanged. (I don’t know if I understood it wrong, some of them have not been tested. Original texthttp://stackoverflow.com/questions/7663078/jquery-mobile-page-refresh-mechanism
Do not use jqm style:
If you don’t want jqm to automatically initialize your elements, there are two methods. Add the data-role="none" attribute, or configure the keepNative option in the mobileinit event