Got a large website with more assets than you know what to do with? It's quick and easy to improve discoverability by building in autosuggest and custom behaviours with nothing more than jQuery and a spare search asset tucked away somewhere.
1. Create a search asset in a hidden directory, customise as necessary.
2. Add an empty div beneath the search field in your website's design.
3. Add the following script to your behaviours .js file (create one if you don't have one), replace 'search_field' with the ID of your search input field, replace 'pathtosuggest' with the URL of your new search asset, ensure 'queries_suggest_query' reflects the name of your search query:
This is a great solution and works great.... Until... the space bar is pressed, then the suggestions disappear. Do you know of a way of addressing this? I'd love to use this method for two projects I have coming up, one is a knowledge bank, and the other is a dynamic questions and answered database. Both of these apps would be expecting the user to type more than one word.