How can I replace all the li of a ul in JQuery, I don't want to add any new item to the list by using append rather I want a new list with new li elements in the same ul.
I have tried
for (index = 0; index < users.length; ++index) {
$('#users').replaceChild(users[index].UserName, $('#users').childNodes[index]);
}
#HTML
<div class="col-md-4" style="margin:auto">
<h2 class="text-success">Users</h2>
<ul id="users" style="list-style:none"></ul>
</div>
but it only add the last element of the Array to the ul,
how to create a new ul when every time I got a new list?