-
-
Save themonster2015/50c25bfa43509b96e852f9053ef62caf to your computer and use it in GitHub Desktop.
(source: https://jsfiddle.net/0rbujn1r/5/)
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
</head> | |
<body> | |
<ul> Ingredients | |
<li>Sugar</li> | |
<li>Milk</li> | |
<li>Eggs</li> | |
<li>Flour</li> | |
<li>Baking Soda</li> | |
</ul> | |
</body> | |
</html> |
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 list = document.querySelectorAll("li"); | |
for ( var i = 0; i < list.length; i++){ | |
list[i].addEventListener( "click", function(e){ | |
alert("Has cliqueado en " + e.target.innerText); | |
} | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment