Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search bar not showing relevant results based on text provided #32

Open
Hrishi456 opened this issue Oct 3, 2023 · 4 comments
Open

Search bar not showing relevant results based on text provided #32

Hrishi456 opened this issue Oct 3, 2023 · 4 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@Hrishi456
Copy link

No description provided.

@VivekJayakumaran
Copy link

<script> document.addEventListener('DOMContentLoaded', function () { const searchBox = document.getElementById('search-box'); const searchResults = document.getElementById('search-results'); const noResultsMessage = document.getElementById('no-results-message'); // Initially hide the "Result not found" message noResultsMessage.style.display = 'none'; searchBox.addEventListener('input', function () { const searchTerm = searchBox.value.trim().toLowerCase(); const packages = document.querySelectorAll('.box'); let hasResults = false; packages.forEach(function (package) { const packageName = package.querySelector('h3').innerText.toLowerCase(); if (packageName.includes(searchTerm)) { package.style.display = 'block'; hasResults = true; } else { package.style.display = 'none'; } }); // Update the display based on search results if (hasResults) { searchResults.style.display = 'block'; noResultsMessage.style.display = 'none'; } else { searchResults.style.display = 'block'; noResultsMessage.style.display = 'block'; } }); }); </script>

@Yash-srivastav16
Copy link
Owner

Anyone here to pick this up..?

@Yash-srivastav16 Yash-srivastav16 added bug Something isn't working good first issue Good for newcomers labels Dec 12, 2024
@Yash-srivastav16 Yash-srivastav16 pinned this issue Dec 12, 2024
@KAmaL-senpai
Copy link

@Yash-srivastav16, Hey I would i like to work on this issue.

@Yash-srivastav16
Copy link
Owner

Hey @KAmaL-senpai , Sure you can work on this. I'm assigning this issue to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants