<HTML>
<head>
<meta charset="utf-8">
</head>
<body>
<h1 id="elem">Hello from the Min script!</h1>
<script>
document.addEventListener("hello", function(event) {
alert("Hello from " + event.target.tagName);
});
//i like it when the code is semantic hahaha
let event = new Event("hello", {bubbles: true});
elem.dispatchEvent(event);
</script>
</body>
</HTML>
<head>
<meta charset="utf-8">
</head>
<body>
<h1 id="elem">Hello from the Min script!</h1>
<script>
document.addEventListener("hello", function(event) {
alert("Hello from " + event.target.tagName);
});
//i like it when the code is semantic hahaha
let event = new Event("hello", {bubbles: true});
elem.dispatchEvent(event);
</script>
</body>
</HTML>
댓글
댓글 쓰기