Displaying 1 result from an estimated 1 matches for "thisli".
Did you mean:
thislm
2008 Jul 01
5
Attaching event observers to a series of elements - best practice?
...on 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.appendChild( thisLI );
Event.observe( thisLI, "click", function() {...