Searchable FAQ
An FAQ list filtered live by a search box with a no-results state.
Requires Bootstrap 5. Add the CDN tags below to your page (styles in
<head>, scripts before </body>). The downloaded file already includes them.<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"><script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script><div class="card border-0 shadow-sm" style="max-width:380px"><div class="card-body">
<input class="form-control form-control-sm mb-3" id="fsSearch" placeholder="Search FAQs…">
<div id="fsList" class="small">
<div class="border-bottom py-2" data-q="reset password account">How do I reset my password?</div>
<div class="border-bottom py-2" data-q="cancel subscription billing">How do I cancel my subscription?</div>
<div class="border-bottom py-2" data-q="export data download">How do I export my data?</div>
<div class="py-2" data-q="contact support help">How do I contact support?</div>
</div>
<div class="text-secondary small text-center py-2" id="fsEmpty" style="display:none">No matches found.</div>
</div></div>var inp=document.getElementById('fsSearch'),items=document.querySelectorAll('#fsList [data-q]'),empty=document.getElementById('fsEmpty');
inp.addEventListener('input',function(){var q=inp.value.toLowerCase(),n=0;items.forEach(function(it){var m=(it.textContent+' '+it.dataset.q).toLowerCase().indexOf(q)>-1;it.style.display=m?'':'none';if(m)n++});empty.style.display=n?'none':'block'});Free to use.This component uses Bootstrap 5 (linked above). Copy any file, or download a ready-to-open .html page with the CDN links already included.