Reputation: 400
I tried to add an event listener on the DOM Window, however, it suggests that Window.addEventListener
is not a function.
<script>
Window.addEventListener('keydown',function (e){
console.log(e);
});
</script>
I expected the console to log the keydown event.
Upvotes: 1
Views: 4812
Reputation: 3011
You have a typo. It must be
//small 'w'
window.addEventListener('keydown',function (e){
console.log(e);
});
Upvotes: 3