Hey guys still still trying to get this to work I want the pages to open in the same window rather than opening a new window?? any suggestions without changing my entire code
function openPage() {
var x = document.getElementById("search").value;
x = x.replace(/\b\w/g, (firstLetter) => firstLetter.toUpperCase());
if (x === "Aaron Carter") {
window.open("files/aaroncarter.html";
}
if (x === "Albert Einstein") {
window.open ("files/alberteinstein.html");
}
else {
window.open ("files/error.html" , "_self")
}
}
<form action="" style="margin-bottom: 40px;">
<div class="input-group">
<input type="search" id="search" autocomplete="off" onchange="openPage()" class="form-control rounded-pill rounded-end-0 border-0 ps-4" placeholder="Search... e.g. Stan Laurel">
<button type="button" id="button" onclick="openPage()" value="Chercher" class="btn btn-primary rounded-pill rounded-start-0 shadow-none">
<i class="fa fa-search"></i>
</button>
</div>
</form>