aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <cb15g11@soton.ac.uk>2014-09-20 16:38:41 +0100
committerChristopher Baines <cb15g11@soton.ac.uk>2014-09-20 16:38:41 +0100
commit32f885f937a4457cca7de15e606d2c2a3bd70896 (patch)
treed3f7930a0054b2b83e518ceb5dd70f63d016393e
parent437a666cb164f34d4f18d57dbf1f10dd6aae60e8 (diff)
downloadmaps.southampton.ac.uk-32f885f937a4457cca7de15e606d2c2a3bd70896.tar
maps.southampton.ac.uk-32f885f937a4457cca7de15e606d2c2a3bd70896.tar.gz
Prevent form submission (page reload) issues with the search box
-rw-r--r--scripts.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/scripts.js b/scripts.js
index 0a9e221..a408c6d 100644
--- a/scripts.js
+++ b/scripts.js
@@ -129,10 +129,6 @@
var isCollapsed = false;
}
- /* Highlight search box text on click */
- $("#searchbox").click(function () {
- $(this).select();
- });
/* Typeahead search functionality */
LS.getData(function(data) {
@@ -251,8 +247,20 @@
sitesBH.initialize();
+ var $searchbox = $("#searchbox");
+
+ /* Highlight search box text on click */
+ $searchbox.click(function () {
+ $(this).select();
+ });
+
+ // prevent the page reloading
+ $searchbox.submit(function () {
+ return false;
+ });
+
/* instantiate the typeahead UI */
- $("#searchbox").typeahead({
+ $searchbox.typeahead({
minLength: 1,
highlight: true,
hint: false