问题
I am wondering if there is a service or solution to creating a website search that will allow me to have the results populate into a dropdown window below my search bar, rather than have to populate the results to a new page. Kind of like google's word prediction/suggestion, but rather than on-the-fly suggestions, I would like a new DIV to drop down with the results upon submission.
The website I am working on is at: http://www.conceptsuppliers.com/beta

回答1:
I highly recommend using the jQuery Tokeninput plugin. I recently implemented this on a site for live searching functionality and it works perfectly.
The library provides options for styling every aspect of the search bar and dropdown results list.
Example:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="jquery.tokeninput.js"></script>
<link rel="stylesheet" type="text/css" href="token-input.css" />
<script type="text/javascript">
$(document).ready(function () {
$("#searchbar").tokenInput("/url_to_your_search_endpoint");
});
</script>
The plugin can be found, along with documentation, here: http://loopj.com/jquery-tokeninput/
来源:https://stackoverflow.com/questions/10341165/dropdown-results-for-website-search