Commit 74af31a7 authored by Muhammad Ameen's avatar Muhammad Ameen 💻

Debounce Project

parents
function debounce() {
let x = setTimeout(() => {
console.log("Muhammad Amenn");
searching.style.display = "block"
}, 1000);
clearTimeout(x - 1);
}
let searching = document.getElementById("searching")
searching.style.display = "none"
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="./style.css" />
<title>Debounce</title>
</head>
<body>
<div class="mainContiner">
<input
type="text"
oninput="debounce()"
class="input"
placeholder="Search Here"
/>
<p id="searching">Searching........</p>
</div>
<script src="./app.js"></script>
</body>
</html>
body {
padding: 0;
margin: 0;
}
.mainContiner {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
height: 100vh;
background-color: rgb(38, 99, 144);
}
.input {
width: 50%;
padding: 20px;
}
p {
color: white;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment