You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
486 B
JavaScript
16 lines
486 B
JavaScript
5 years ago
|
document.addEventListener("DOMContentLoaded", function() {
|
||
|
const searchBar = document.getElementById("search-bar");
|
||
|
const searchBtn = document.getElementById("search-submit");
|
||
|
|
||
|
searchBar.addEventListener("keyup", function(event) {
|
||
|
if (event.keyCode === 13) {
|
||
|
event.preventDefault();
|
||
|
searchBtn.click();
|
||
|
}
|
||
|
});
|
||
|
|
||
|
searchBtn.onclick = function() {
|
||
|
window.location.href = '/search?q=' + encodeURI(searchBar.value);
|
||
|
}
|
||
|
});
|