Last active
December 19, 2018 22:02
-
-
Save harrisonmalone/bdf808a51c82258f86cd88e08f4b7e72 to your computer and use it in GitHub Desktop.
This file contains hidden or 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"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
<style> | |
.wrapper { | |
display: flex; | |
} | |
.container { | |
width: 50%; | |
margin: 10px; | |
box-sizing: border-box; | |
border: 1px solid black; | |
height: 50vh; | |
} | |
li { | |
width: 100px; | |
} | |
.hide { | |
display: none; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="wrapper"> | |
<div class="container"> | |
<ul class="available-users"> | |
<li>Harrison</li> | |
<li>Lili</li> | |
<li>Luke</li> | |
<li>Anhar</li> | |
<li>Guy</li> | |
</ul> | |
</div> | |
<div class="container"> | |
<div class="attending"> | |
</div> | |
</div> | |
</div> | |
<script> | |
const attendingArr = Array.from(document.querySelector('.attending').children) | |
const attending = document.querySelector('.attending') | |
const availableUsersArr = Array.from(document.querySelector('.available-users').children) | |
const availableUsers = document.querySelector('.available-users') | |
availableUsersArr.forEach((name, index) => { | |
name.addEventListener('click', (event) => { | |
const li = document.createElement('li') | |
li.innerText = event.target.innerText | |
attending.append(li) | |
}) | |
}) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment