Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (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);
- }
Add Comment
Please, Sign In to add comment