How can i add search box to work with these accordion code?

did use it as with these code however is not functioning as it should 🙁

$  ("#faqsSearch").on("keyup", function () {             var value = $  (this).val().toLowerCase();             $  ("#accordion").filter(function () {             accordion.style.display = "block";                   $  ('#accordion').toggle($  (this).text().toLowerCase().indexOf(value) > -1)             });         });