search for: populatecontactslist

Displaying 1 result from an estimated 1 matches for "populatecontactslist".

2008 Jul 01
5
Attaching event observers to a series of elements - best practice?
...e''s the tricky part—attach an onclick observer to each <li>, which calls the openContact() function and passes in the ID of the contact that was clicked. I understand closures. However, I haven''t found an elegant way to solve the problem. This won''t work: function populateContactsList( contacts ) var theUL = document.getElementById("addr-book-index"); var thisLI = null; for ( var i = 0; i < contacts.length; i++ ) { thisLI = document.createElement("li"); thisLI.appendChild( document.createTextNode( contacts[i].name ) ); theUL...