I am trying to add keywords to my search system which im using Javascript rather than a database is there any way I can add keywords so the user can put the second name instead of the full name see the code description, thanks guys
<button class="search-submit" type="submit" id="button" onclick="openPage(event)" value="Chercher" aria-label="submit search" data-search-toggler>
<ion-icon name="search-outline"></ion-icon>
</button>
<button class="search-close" aria-label="close search" data-search-toggler></button>
function openPage(event) {
event.preventDefault();
var x = document.getElementById("search").value;
x = x.replace(/bw/g, (firstLetter) => firstLetter.toUpperCase());
//=======================================================================================
if (x === "Aaron Carter") {
window.location.href = "files/aaroncarter.html";
}
else if (x === "Adolf Hitler") {
window.location.href = "files/adolfhitler.html";
}
else if (x === "Albert Einstein") {
window.location.href = "files/alberteinstein.html";
}
//=======================================================================================
else {
window.location.href = "addceleb/index.html";
}
}
4