search functionnality

This commit is contained in:
Valentin CZERYBA 2022-08-15 18:24:15 +02:00
parent 14fdc8e10c
commit cc3663f1a5
2 changed files with 10 additions and 1 deletions

View File

@ -91,7 +91,7 @@
<button class="navbar-toggler position-absolute d-md-none collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#sidebarMenu" aria-controls="sidebarMenu" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<input class="form-control form-control-dark w-100 rounded-0 border-0" type="text" placeholder="Search" aria-label="Search">
<input class="form-control form-control-dark w-100 rounded-0 border-0" id=searchUser type="text" placeholder="Search" aria-label="Search">
<div class="navbar-nav">
<div class="nav-item text-nowrap">
<a class="nav-link px-3" id="signout" href="#">Deconnecté</a>

View File

@ -98,6 +98,15 @@ instance.get("users", {withCredentials: true, params :{ page:page, nbPages: nbPa
document.getElementById("addUser").addEventListener("click", function(){
location.href="/html/adduser.html";
});
document.getElementById("searchUser").addEventListener("keydown", function(ev){
if(ev.key === "Enter"){
var search = document.getElementById("searchUser").value;
if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(search)){
alert(search);
}
}
})