Skip to content

Commit

Permalink
Prevent search when query field is empty (ordinals#2425)
Browse files Browse the repository at this point in the history
  • Loading branch information
elocremarc authored Sep 6, 2023
1 parent 8479ae0 commit 80f32e6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions static/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,12 @@ window.addEventListener('keydown', e => {
return;
}
});

const search = document.querySelector('form[action="/search"]');
const query = search.querySelector('input[name="query"]');

search.addEventListener('submit', (e) => {
if (!query.value) {
e.preventDefault();
}
});

0 comments on commit 80f32e6

Please sign in to comment.