Execute jquery autocomplete on button press

ajax, autocomplete, javascript, jquery, jquery-ui

Solution

Well, you probably want to use a library to achieve your result.

Ex : http://jqueryui.com/autocomplete/

In your case, it would be something like that :

$('button').click(function() {
     $('input').autocomplete('enable');
});

as found on this page : http://api.jqueryui.com/autocomplete/#method-enable

Problem

I have a text field and a forum button (not submit). I would like the user to type in a location in the text field, then click the button. I want to the button to trigger an autocomplete event on the textfield which will call an ajax to return possible values. I know how to do the actual mechanics of the autocomplete, but its the triggering via the button that I don't know how to do.

Original source

Related problems