JQuery Autocomplete Form Submission
Posted
by
user1658370
on Stack Overflow
See other posts from Stack Overflow
or by user1658370
Published on 2012-11-25T13:34:58Z
Indexed on
2012/11/25
17:04 UTC
Read the original article
Hit count: 168
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.
© Stack Overflow or respective owner