JS DOM: 19. Event global
by istiq20
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Event Global</title>
</head>
<body>
<input id="clickMe" type="button" value="Click Me!" />
<script>
const button = document.getElementById("clickMe");
// hanya bisa menambahkan 1 event handler
button.onclick = function () {
button.setAttribute("value", "You Already Click Me!");
console.log("Button di Click");
};
</script>
</body>
</html>