Pepi San
Pepi San

Reputation: 93

jQuery autocomplet action

I implement an autocomplet function in a database; the search area is an 'input' attached to a form and I want that when a choice is made in the list, the action of the form is triggered automatically. Actually, I've got to select my choice and validate this form.

I tried to detect the change into the field:

  $("#tags").change(function() {
      $( "#search_form" ).submit();
    });  

but that doesn't work.

Any suggestions ?

Upvotes: 0

Views: 51

Answers (2)

Pepi San
Pepi San

Reputation: 93

    $("#tags").autocomplete({
      source: availableTags,
      select: function(event, ui) {             
                    $("#search_form").submit(); 
                    }
    });   

That works

Upvotes: 0

RebelFist
RebelFist

Reputation: 559

Change only fires when blur() happens (the element loses focus). Try using keydown/keypress/etc.

Upvotes: 1

Related Questions