(() => {
document.addEventListener("DOMContentloaded", () =>
tc = document.getElementById("coor");
tc.addEventListener("click", (evt) => {
alert(evt.clientX);
});
});
})();
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<input type="button" id="coor" value="Coordenadas" />
</body>
</html>
It does not show me neither alert nor error, what I want to achieve is to show the X coordinates, by clicking the button.