JQuery Autocomplete Form Submission
- by user1658370
I have managed to implement the jQuery autocomplete plugin on my website but was wondering if it is possible to make the form auto-submit once the user selects an item from the search. I have the following set-up:
HTML Form:
<form class="quick_search" action="../include/search.php" method="post">
<input type="text" name="search" id="search" value="Search...">
</form>
JavaScript:
$().ready(function() {
$("#search").autocomplete("../include/search.php", {
width: 350,
selectFirst: false
});
});
I have also included the jQuery and Autoplugin scripts. The search.php file contains a list of the search options.
At the moment, the search works correctly and I just need it to submit the form once an item is selected from the list that appears. I tried to use the onClick and onSelect options within the search field but neither of these worked correctly.
Any help would be much appreciated (I don't really understand js)! Thanks.