Sha256: d58c3e89acfe08a260f94d768179a2853bb2a955c4ce8600f502049b09b42d29
Contents?: true
Size: 664 Bytes
Versions: 13
Compression:
Stored size: 664 Bytes
Contents
const form = document.getElementById('SearchTermForm'); const searchURL = 'https://www.kcc.edu/search'; function submissionHandler(e) { const target = e.target; const searchString = encodeURIComponent(target.querySelector('#searchTermInput').value); // user enter search term into input element // Google Custom Search can be triggered using a query string on the search page e.g. `?q=my-search` const searchQuery = `?q=${searchString}`; e.preventDefault(); return window.location = new URL(searchURL + searchQuery); } function watchForWebsiteSearch() { form.addEventListener('submit', submissionHandler); } export default watchForWebsiteSearch;
Version data entries
13 entries across 13 versions & 1 rubygems