aboutsummaryrefslogtreecommitdiff
path: root/public/javascripts/search.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/javascripts/search.js')
-rw-r--r--public/javascripts/search.js15
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 () {