I have a page with several sections on different pages as word concepts, and I want to implement a search engine so that the user searches for the word, when clicking it redirects it to another page with the results and another option that redirects it to a page with the word what are you looking for
This is my code
HTML
<input class="form-control me-2" type="search" placeholder="Write..." id="text" aria-
label="Search" required>
<button class="btn btn-outline-success" onclick="Search();">Search <i class="fas fa-search">
</i></button>
Javascript
function Search(text){
var text = document.getElementById("text").value;
if (texto == "a"){
window.location.assign("results.html");
}else if (text == "azure"){
window.location.assign("azure.html");
}else
no results
}
}
I am not sure if the search engine is dynamic as I am proposing with this code, I have consulted other sites and they have told me that it is not recommended this way with this code, so if there is a possibility with another code or if there is any error with this, please help me ...