Skip to content

Commit

Permalink
Improved the search result based on description (#1181)
Browse files Browse the repository at this point in the history
  • Loading branch information
Anshika14528 authored Jun 5, 2024
1 parent 6e2e1df commit fc146bb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,11 @@ function filterCalculators() {
for (i = 0; i < calculators.length; i++) {
var calculator = calculators[i];
var h2 = calculator.querySelector('h2');
var h3 = calculator.querySelector('h3');
var calculatorName = h2.textContent || h2.innerText;
var calculatorDescription = h3.textContent || h3.innerText;

if (calculatorName.toUpperCase().indexOf(filter) > -1) {
if ((calculatorName.toUpperCase().indexOf(filter) > -1) || (calculatorDescription.toUpperCase().indexOf(filter) > -1)) {
calculator.style.display = "flex";
hasResults = true;
} else {
Expand All @@ -134,7 +136,7 @@ function filterCalculators() {
}
}

document.addEventListener('DOMContentLoaded', function() {
document.addEventListener('DOMContentLoaded', function () {
document.getElementById('noResults').style.display = 'none';
});

Expand Down

0 comments on commit fc146bb

Please sign in to comment.