I've tried everything and if anyone could explain why this JavaScript code is not causing the alert button to be shown when I press enter on the HTML input field, that would be greatly appreciated.
document.getElementById("inp").addEventListener("keypress", clickedEnter, false);
function clickedEnter(event){
if(event.key == "Enter"){
alert("true");
}
}
<input type = "text" class = "inp" id = "inp" placeholder="Add Item">