I'm trying to make an instant search box. When user start typing in the search box, it triggers a javascript event to hide the blog posts (#home) and search results will be shown instead (this part of the script is not included below). However, after user cleared the search box, they see just a blank page as the display of #home is still set to be none.
How can I make JavaScript detect the user cleared the input filed at #search-input and make #home display true again?
document.getElementById('search-input').oninput = function() {
document.getElementById('home').style.display = 'none';
};
