This is not a duplicate of "Why does jQuery or a DOM method such as getElementById
not find the element?". I have a form that is supposed to trigger a bunch of events but none of the functions get called. I added a button just for the purpose of testing.
The HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset ="utf-8" />
<title>Sign in</title>
<link rel="stylesheet" type="text/css" href="main.css" />
<link rel="stylesheet" type="text/css" href="passphrase.css" />
</head>
<body>
<noscript>
Javascript is disabled. Now redirecting.
<meta HTTP-EQUIV="REFRESH" content="0; url=passnojs.html">
</noscript>
Welcome.
<form method="post" action="prolevel2.php" id="loginForm">
<!--code snipped-->
<br /><br /><input type="button" value="big ugly button" id="testing" />
</form>
<script src="verify.js"></script><!--this should work because it's after the HTML-->
</body>
</html>
Included external JavaScript
alert("begining")
document.getElementById('testing').addEventListener('onclick', display, false)
alert("here now")
function display()
{
alert("now displaying")//doesn't work
}
"begining" and "here now" are displayed but "now displaying is not". There are no messages in the console. What am I doing wrong?