jQuery Autocomplete plugin makes an input or textarea autocompleteable.
autocomplete( url or data, [options] )
Let's make an example to using extraParams to pass additional get variables:
HTML:
Javascript:
$('#txtAuto').autocomplete('search.php', {
extraParams: {
filter: function(){
return $('#txtFilter').val();
}
}
})
The above code following jQuery Autocomplete Plugin, is NOT working for me. So I do other way.
Javascript:
$('#txtAuto').autocomplete('search.php', {
mustMatch: false
}
})
$('#txtAuto').setOptions({
extraParams:{filter: function(){return $('#txtFilter').val();}
}
});
It's working now!
Note: mustMatch option should be set to false to prevent autocomplete calling search.php again after you select item.
Correct me if i'm wrong :)
Happy coding!
Comments
$("#acnew").setOptions is not a function error, any suggestion would be appreciated.