Created
December 23, 2017 05:59
-
-
Save piratefsh/60bc9cf0604dd17a1680a277e2a41a0f to your computer and use it in GitHub Desktop.
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> | |
<head> | |
<title>Interactive Features</title> | |
</head> | |
<body> | |
<ul id="my-list"> | |
<li id="1">item1</li> | |
<li id="2">item2</li> | |
<li id="3">item3</li> | |
<li id="4">item4</li> | |
<li id="5">item5</li> | |
</ul> | |
<script> | |
function playerSelected(event){ | |
const cellClicked = event.target.id; | |
} | |
// cell1.setAttribute('onclick', 'playerSelected()'); | |
cell1.onclick = playerSelected; | |
function showListItem(event){ | |
console.log(event.target.id) | |
alert('hi') | |
} | |
const list = document.getElementById('my-list'); | |
const getTds = document.querySelector('#my-table td') | |
for(let i = 0; i < getTds.length; i++){ | |
const child = getTds[i]; | |
child.onclick = showListItem; | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment