ja napisałem increbily prosty detektor zdarzeń, a mimo to pojawia się z błędem: Uncaught TypeError: Cannot call method 'addEventListener' of null
co sugeruje, że jest to zrobić z identyfikatorem być może (również współpracuje z document
Prosty detektor zdarzeń nie działa - JS
<html>
<head>
<script type="text/javascript">
function message() {
alert("Hello!");
}
var button = document.getElementById('button');
button.addEventListener('click', message, true);
</script>
</head>
<body>
<input type="button" id="button" value="Click me!" />
</body>
</html>
?
(Wiem, że będę głupio po tym, ale jestem JS noob)
Umieść sekcję skryptu na dole sekcji ciała tuż nad '