Skip to content

Commit

Permalink
Check that textinput and resetbutton are actually present in init fun…
Browse files Browse the repository at this point in the history
…ction
  • Loading branch information
LuomaJuha committed Nov 16, 2023
1 parent a043501 commit af660df
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions themes/bootstrap3/js/searchbox_controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,13 @@ VuFind.register('searchbox_controls', function SearchboxControls() {
_textInput = document.getElementById('searchForm_lookfor');
_resetButton = document.getElementById('searchForm-reset');

_textInput.addEventListener("input", function resetOnInput(event) {
_handleInputChange(event.target.value, false);
});

// Text input and reset button must both be present
if (!_textInput || !_resetButton) {
return;
}
_resetButton.addEventListener('click', function resetOnClick() {
_handleInputChange('');
});

if (typeof window.SimpleKeyboard !== 'undefined') {
_initKeyboard();
}
Expand Down

0 comments on commit af660df

Please sign in to comment.