Clear text box in Jquery Autocomplete after selection

I want to clear the textbox having Jquery Autocomplete once the user has made the selection.

I tried to clear the field by :

select: function(event, ui) {

But this is not working.I am using jquery-1.6.4 and jquery-ui-1.8.16.

Any Ideas?


The select event occurs before the field is updated. You will have to cancel the event to avoid the field being updated after you have cleared it:

select: function(event, ui) {
    return false;

Update: As T.J. pointed out below, it's slightly faster to update the value DOM property directly instead of going through val():

select: function(event, ui) {
    this.value = "";
    return false;

I'm using jQuery UI version 1.8.23 and $(this).val(""); on select event hasn't worked for me, but this did:

    // ...
    close: function(el) { = '';


select: function(event, ui) {

You may also try this:


which will hide all the autocomplete filtered list upon selecting it.

Need Your Help

What does "Symbol not found / Expected in: flat namespace" actually mean?

python c++ import namespaces importerror

When I import a module I built, I get this boost-python related error:

Chaining git hooks

git githooks

As many of you probably know, there can be only one hook type in git.