How to get a list of the items for autocomplete? I mean, the source values (hints for autocomplete). I tried this:
$("#autocomplete").autocomplete('option', 'source');
But this doesn't work.
Sorry for my poor Enlish and poor jQuery knowledge.
How to get a list of the items for autocomplete? I mean, the source values (hints for autocomplete). I tried this:
$("#autocomplete").autocomplete('option', 'source');
But this doesn't work.
Sorry for my poor Enlish and poor jQuery knowledge.
If you wanna to set item for autocomplete
Try like this
$("#autocomplete").autocomplete({
source : ["dum1","dum2"]
});
After initialize
for getting
var source = $( "#autocomplete" ).autocomplete( "option", "source" );
console.log(source)
for setting
$( "#autocomplete" ).autocomplete( "option", "source", [ "dum3", "dum4", ] );
var source = $( ".selector" ).autocomplete( "option", "source" )
console.log(source)
response: ['val1','val2','val3']