From 48ff1bf9ced458796a0f9bc7e9669a70e910bf0e Mon Sep 17 00:00:00 2001 From: Anshika Yadav <14anshika7yadav@gmail.com> Date: Tue, 4 Jun 2024 21:27:35 +0530 Subject: [PATCH] Improved the search result based on description #1014 --- script.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/script.js b/script.js index fdc3c1e70..967478c66 100644 --- a/script.js +++ b/script.js @@ -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 { @@ -134,7 +136,7 @@ function filterCalculators() { } } -document.addEventListener('DOMContentLoaded', function() { +document.addEventListener('DOMContentLoaded', function () { document.getElementById('noResults').style.display = 'none'; });