fixed issue where search suggestions happened twice, causing weird behavior
This commit is contained in:
parent
7e1b946bcc
commit
de2aaf117c
1 changed files with 1 additions and 9 deletions
|
@ -52,6 +52,7 @@ async function getSuggestions(query) {
|
||||||
|
|
||||||
let currentIndex = -1; // Keep track of the currently selected suggestion
|
let currentIndex = -1; // Keep track of the currently selected suggestion
|
||||||
|
|
||||||
|
// Handle click events on the type buttons
|
||||||
let results = [];
|
let results = [];
|
||||||
searchInput.addEventListener('input', async () => {
|
searchInput.addEventListener('input', async () => {
|
||||||
let input = searchInput.value;
|
let input = searchInput.value;
|
||||||
|
@ -128,15 +129,6 @@ function renderResults(results) {
|
||||||
resultsWrapper.innerHTML = `<ul>${content}</ul>`;
|
resultsWrapper.innerHTML = `<ul>${content}</ul>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to handle search input
|
|
||||||
searchInput.addEventListener('input', async () => {
|
|
||||||
let input = searchInput.value;
|
|
||||||
if (input.length) {
|
|
||||||
const results = await getSuggestions(input);
|
|
||||||
renderResults(results);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Handle click events on the type buttons
|
// Handle click events on the type buttons
|
||||||
const typeButtons = document.querySelectorAll('[name="t"]');
|
const typeButtons = document.querySelectorAll('[name="t"]');
|
||||||
typeButtons.forEach(button => {
|
typeButtons.forEach(button => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue