I am trying to fire a event listener from a link. Why is below code not working?
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript">
document.getElementById("test").addEventListener('click', function(event)){
alert('test');
});
</script>
</head>
<body>
<a id ="test" class="button" href="#">Test</a><br>
</body>
</html>
` tag.
– T.J. Crowder May 18 '18 at 08:50--- try with given solution
– Priyal Pithadiya May 18 '18 at 08:53