diff options
author | Christopher Baines <cb15g11@soton.ac.uk> | 2014-09-20 16:38:41 +0100 |
---|---|---|
committer | Christopher Baines <cb15g11@soton.ac.uk> | 2014-09-20 16:38:41 +0100 |
commit | 32f885f937a4457cca7de15e606d2c2a3bd70896 (patch) | |
tree | d3f7930a0054b2b83e518ceb5dd70f63d016393e | |
parent | 437a666cb164f34d4f18d57dbf1f10dd6aae60e8 (diff) | |
download | maps.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.js | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -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 |