Skip to content

Instantly share code, notes, and snippets.

@halilim
Created August 27, 2014 08:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halilim/5d1f75c57b2af83166f4 to your computer and use it in GitHub Desktop.
Save halilim/5d1f75c57b2af83166f4 to your computer and use it in GitHub Desktop.
jsist easter
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