diff options
author | Noah Loomans <noahloomans@gmail.com> | 2017-01-30 17:56:25 +0100 |
---|---|---|
committer | Noah Loomans <noahloomans@gmail.com> | 2017-01-30 17:56:25 +0100 |
commit | 344504782ac628b15229cafada34a9f32d595624 (patch) | |
tree | 532293fef971164b21e3227955ff532668f850a1 /public/javascripts/search.js | |
parent | 29ea424009be3bd8561e74587b651c1c44bf2f7e (diff) | |
parent | 25fbba2084a23fb62ab0e7fdf2dd47eadc28a967 (diff) |
Merge branch 'update-url' into beta
Diffstat (limited to 'public/javascripts/search.js')
-rw-r--r-- | public/javascripts/search.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/public/javascripts/search.js b/public/javascripts/search.js index a07d6dd..e6cf3a9 100644 --- a/public/javascripts/search.js +++ b/public/javascripts/search.js @@ -25,10 +25,17 @@ self.submit = function () { } self.updateDom = function (selectedItem) { - self._nodes.input.value = selectedItem.value - autocomplete.removeAllItems() - document.body.classList.remove('no-input') - document.body.classList.add('searched') + if (selectedItem == null) { + self._nodes.input.value = '' + autocomplete.removeAllItems() + document.body.classList.add('no-input') + document.body.classList.remove('searched') + } else { + self._nodes.input.value = selectedItem.value + autocomplete.removeAllItems() + document.body.classList.remove('no-input') + document.body.classList.add('searched') + } } self.focus = function () { |