I was wondering about how to empty a list in a proper way. Is it better to have a list in a div and then empty the div or the list?
I know this is a lame question but please help my understand this empty() function:)
Case) What happens if I run this script:
$('#mylist).empty();
...on this list:
<ul data-role="listview" id="mylist" data-inset="true" data-theme="a"><li>Hello!</li></ul>
Does it become: A):
<ul data-role="listview" id="mylist" data-inset="true" data-theme="a"><li></li></ul>
Or does it become: B):
<ul data-role="listview" id="mylist" data-inset="true" data-theme="a"></ul>
Or does it become just this: C):
<ul></ul>
It looks like it becomes just this because next time I try to add stuff to my "mylist" list after I have run empty() on it. I want it to still have the listview format and not this:
<ul></ul>.
MyCode snippet:
$('#mylist').empty();
var newlist = "<ul data-role=" + "'listview'" +" id=" + "'mylist'" + " data-inset=" + "'true'" + " data-theme=" + "'a'" + "><li>Hello!</li></ul>";
$('#mylist').append(newlist).listview().trigger('create');