I am trying to add an event listener to a search button. I already have the event listener for the enter button but want people to be able to click on the search button as well. For example, on a mobile device they will have to do this. Could someone please help me? Any help would be massively appreciated. Thanks
enquiryRef.addEventListener('keypress', checkIfEnter);
function checkIfEnter(event){
if (event.keyCode === 13) {
getResults(enquiryRef.value);
}
}
Add the event listener to the search button too.
searchBtn.addEventListener('keypress', checkIfEnter);