-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
23 lines (20 loc) · 753 Bytes
/
index.html
File metadata and controls
23 lines (20 loc) · 753 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Settings</title>
<script type="module" src="./my-element/my-element.js"></script>
</head>
<body>
<button id="removeElement">remove</button>
<button id="addElement">add</button>
<div id="elements">
<my-element></my-element>
</div>
<script>
const elementContainer = document.querySelector('#elements');
document.querySelector('#removeElement').addEventListener('click', () => { elementContainer.removeChild(elementContainer.querySelector('my-element')); });
document.querySelector('#addElement').addEventListener('click', () => { const elem = document.createElement('my-element'); elementContainer.appendChild(elem); });
</script>
</body>
</html>