creating dynamic list with jquery

Viewed 35836

let me start by saying that i saw similar questions on forum, however i didn't find one which i managed to understand and apply to my situation.

Having said that, my question is as follows:

I want to build a list which dynamically changes. ( the list shows the names of useres who are currently logged in).

Let's say that the names of the logged in users are stored in an array = ["name1", "name2", "name3" ....] and that the data in the array is the updated data.

the form is:

<div id="users">
    <ul class="list">
      <li>
        <h3 class="name">name1</h3>
      </li>
      <li>
        <h3 class="name">name2</h3>
      </li>
    </ul>
  </div> 

how can i modify the list, using jquery, to display the names form the array and dynamically change by it's content?

many thanks.

2 Answers
Related