VS code crosses out event.key. I think it's deprecated. I want the code below to run when I press enter. What should I do VS code crosses out event.key. I think it's deprecated. I want the code below to run when I press enter. What should I do
//js code
document.querySelector("#addNewTaskBtn").addEventListener("click",newTask);
document.querySelector("#addNewTaskBtn").addEventListener("keypress",()=>{
// Problem is here
if(event.key=="Enter"){
//vs code crosses out event.key. I think it's deprecated. I want the code below to
//run whenI press enter. What should I do
document.getElementById("addNewTaskBtn");
}
});