Skip to content

Latest commit

 

History

History
22 lines (19 loc) · 739 Bytes

File metadata and controls

22 lines (19 loc) · 739 Bytes

<--Return Home

Bootstrap

Add a search box with cancel button, and JS instant Search features

Only for chrome

 <input type="search" name="searchTerm" class="form-control" id="searchField" autocomplete="off" placeholder="">
/*restore the cancel button on searchbox that bootstrap breas*/
input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: searchfield-cancel-button;
}
// if any key is entered, fire searchField()
document.querySelector('#searchField').addEventListener('keyup', searchField, false);
// if the "x" button is clicked on search box, fire searchField()
document.querySelector('#searchField').addEventListener("search", searchField, false);