Mobile jQuery theme not working

I dynamically add LI to ul using jquery, but the jquery mobile theme doesn't apply.

here is my code

$('#employee_list').on("click", "a", function() { var li_id = this.id; $("#chart").html(" "); var title = '<li id="visited"><a href="#" data-role="button" data-inline="true">True</a>'; $("#main_child_ul").append(title); $('#org').trigger("create"); $("#org").jOrgChart({ chartElement : '#chart', dragAndDrop : true }); //$("#orgger").collapsibleset(); }); 

and here is the html

 <ul id="org" style="display:none"> <li id="visited"><a href="#" data-role="button" data-inline="true">True</a> <ul id="main_child_ul" class="children"> </ul> </li> </ul> 

Any help? this addition of tree nodes is dynamic, but the theme does not apply.

+1
source share
1 answer

When you add items to the list, you need to call the refresh () method to update the styles for the added items.

Example:

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

Let me know if it works.

thanks

0
source

Source: https://habr.com/ru/post/1502082/


All Articles