Commit 8cbf7cb5 authored by Muhammad Ameen's avatar Muhammad Ameen 💻

some conditions add

parent 71e4de7d
let searching = document.getElementById("searching");
let count = document.getElementById("count");
let input = document.getElementById("input");
var num = 0;
let num = 0;
let preValVar = "";
function debounce() {
if (input.value?.length > 0) {
if (input.value.length > 0) {
let x = setTimeout(() => {
console.log("Muhammad Amenn");
searching.style.display = "block";
num++;
count.innerHTML = num;
if (input.value !== preValVar) {
console.log(input.value == preValVar);
num++;
count.innerHTML = num;
preValVar = input.value;
}
}, 1000);
clearTimeout(x - 1);
}
}
......@@ -16,7 +16,7 @@
placeholder="Search Here"
id="input"
/>
<p class="count" id="searching">Api Hit <span style="color: red; font-size: 30px;" id="count">0</span></p>
<p class="count" id="searching">API Hit <span style="color: red; font-size: 30px;" id="count">0</span></p>
</div>
<script src="./app.js"></script>
......
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