Prevent search form submit
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
912a657d94
commit
f4e988c314
|
@ -86,15 +86,19 @@
|
||||||
// Register input event
|
// Register input event
|
||||||
document
|
document
|
||||||
.getElementById('searchbox')
|
.getElementById('searchbox')
|
||||||
.addEventListener('input', _.debounce(this.search, 500), true);
|
.addEventListener('input', _.debounce(self.search, 500), true);
|
||||||
document
|
document
|
||||||
.querySelector('form.searchbox')
|
.querySelector('form.searchbox')
|
||||||
.addEventListener('submit', _.debounce(this.search, 500), true);
|
.addEventListener('submit', function(event) {
|
||||||
|
// Avoid form submit
|
||||||
|
event.preventDefault();
|
||||||
|
_.debounce(self.search, 500);
|
||||||
|
}, true);
|
||||||
|
|
||||||
// Register reset
|
// Register reset
|
||||||
document
|
document
|
||||||
.querySelector('form.searchbox')
|
.querySelector('form.searchbox')
|
||||||
.addEventListener('reset', _.debounce(this.reset, 500), true);
|
.addEventListener('reset', _.debounce(self.reset, 500), true);
|
||||||
|
|
||||||
// Register esc key shortcut reset if focused
|
// Register esc key shortcut reset if focused
|
||||||
document.addEventListener('keyup', function(event) {
|
document.addEventListener('keyup', function(event) {
|
||||||
|
|
Loading…
Reference in New Issue