I’ve been trying to figure out how to submit the form when the person selects the result from choices of the autocomplete. It needs to work with a mouse click or enter button. I see examples out there but always in pieces. No one shows the entire function.
I have this code below but I get errors saying result is not a function. I don’t know how to combine this to do what I would like. Any help is appreciated.
jQuery(document).ready(function(){
jQuery("#vsearch").autocomplete("ajax/search.php",
{
minLength: 2
}
);
jQuery("#vsearch").result(function(event, data, formatted) {
jQuery('#vsearch').value( formatted );
jQuery('#search').submit();
});
});
From: http://api.jqueryui.com/autocomplete/#event-select
So you would use:
EDIT: (modified in case user does not select anything)
If I am sure of what you are wanting to do.