Created
August 27, 2014 08:00
-
-
Save halilim/5d1f75c57b2af83166f4 to your computer and use it in GitHub Desktop.
jsist easter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var container = document.getElementById('answer'); | |
for(var i = 1; i <= 5; i++) { | |
(function(i) { | |
var a = document.createElement("a"); | |
a.innerHTML = "link" + i + " "; | |
var onClick = function () { | |
alert(i); | |
}; | |
a.addEventListener("click", onClick); | |
container.appendChild(a); | |
})(i); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment