Results 1 to 1 of 1
Thread: Problem with autosuggest
Mar 28, 2010, 04:26 #1
- Join Date
- Oct 2009
- 0 Post(s)
- 0 Thread(s)
Problem with autosuggest
I've developed a simple auto suggest for my site - its similar to facebooks in that it comes up with people (friends) of the person as they're typing into the search box at the top of my page.
It's probably a bit messy in that the search box's html looks like this:
<input autocomplete="off" type="text" id="search_box" name="q" class="search_box" value="Search" onfocus="this.value = '';" onKeyUp = "typeahead(this)" onblur="if(this.value=='') this.value='Search'; setTimeout('hide(\'search_top\')',500);" /> <span class="results_box_hidden" style="display: none" id="search_top">Loading...</span>
If quite a few results turn up i add a scroll bar to the results so that the list doesn't go all the way down the page, and in firefox and some others this works fine. But in Safari and Chrome (possibly others) when you click on the scroll bar it fires the blur event of the search box thus hiding the results.
So my question is can i fix this somehow? Or otherwise is there a way to neaten this up a whole lot and solve this problem at the same time?