Online sharepoint: How can I add a search box to work with these accordion codes?

I used it because with this code, however, it does not work as it should 🙁

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