Skip to content

Instantly share code, notes, and snippets.

@aadsm
Created October 23, 2011 08:25
Show Gist options
  • Select an option

  • Save aadsm/1307073 to your computer and use it in GitHub Desktop.

Select an option

Save aadsm/1307073 to your computer and use it in GitHub Desktop.
(function(ul) {
arr.forEach(function(text) {
setupItem(ul.appendChild(document.createElement("li")), text);
})
})(document.appendChild(document.createElement("ul")));
function setupItem(li, text) {
li.textContent = text;
li.addEventListener("click", onClick, false);
}
function onClick() {
alert(this.textContent);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment