Files
web-components-workshop-dep…/index.html
2017-12-12 15:22:28 +01:00

30 lines
982 B
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript" src="/bower_components/webcomponentsjs/webcomponents-lite.js"></script>
</head>
<body>
<h1>WebComponents workshop</h1>
<p>In this workshop, we will create new custom HTML Components</p>
<h2>Creating a new component</h2>
<hello-world></hello-world>
<div>
<button onclick="removeHelloWorld()">Click me to remove Hello World</button>
</div>
<script src="src/components/hello-world.js"></script>
<script>
function removeHelloWorld(){
console.log("Called!");
const helloElement = document.getElementsByTagName("hello-world")[0];
helloElement.parentNode.removeChild(helloElement);
}
</script>
</body>
</html>