handleEvents is not defined | javascript

hie i m working on some live project and have written some code,but i got 1 error and i try to resolve with correct method but it isnt working please someone check where i m lacking on clicking search button it show error eventhandler not defined

screenshot of my console log screenshot 2

this is the function i want to run

 function handleEvents(){
if(window.navigator.onLine){
    searchResult.style.display= "block";
    searchPage.style.display= "none";
    const title= search.value;
    if(title){
        searchTitle.innerText= title;
        showMovies(SEARCHAPI+title);
        search.value= ""
    }
    else{
        searchTitle.innerText= "No Title";
        searchPage.style.display= "none";
        offlinePage.style.display= "flex";
        message.innerHTML= "Type something to search"
    }
}
else{
    searchPage.style.display = "none";
    offlinePage.style.display= "flex"
}

}

i tried this also

<button type="button" id="btn" onclick="handleEvents()">Search</button>


Read more here: https://stackoverflow.com/questions/67381023/handleevents-is-not-defined-javascript

Content Attribution

This content was originally published by jacklie at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: