jqueryautocomplete

Make jQuery autocomplete not to fill the input value with the label of selected item


Is there any way to make jQuery autocomplete plugin only respond to the "select" callback, not to fill the target input with the label value of the selected item after user selection?


Solution

  • Demo on JSFiddle

    $('#ac').autocomplete({
        source : ["hello", "how", "do", "you", "do"],
        select: function(event, ui){
            setTimeout(function (){
              $('#ac').val('');    
            }, 1000)
        }
    })