Hey there! I'm in the process of adding a search feature to my Jekyll site, and I've opted to use Simple-Jekyll-Search
, which you can check out here: Link.
Take a peek at what's inside my search.html
:
<input type="text" id="my-search-input" placeholder="Search">
<div class="card">
<ul id="my-results-container"></ul>
</div>
<script src="/assets/javascript/simple-jekyll-search.min.js" type="text/javascript"></script>
<script>
SimpleJekyllSearch({
searchInput: document.getElementById('my-search-input'),
resultsContainer: document.getElementById('my-results-container'),
searchResultTemplate: '[...]',
json: '/search.json',
noResultsText: '<li><p>No results found!</p></li>'
})
</script>
The search functionality is working smoothly so far. But here's the thing - that bordered card pops up even when the search bar is empty. So, my burning question is:
Any ideas on how I can keep the card hidden until the user starts typing something?