var status_used = $( "#auto_c" ).autocomplete( "option", "classes.ui-autocomplete" );
To set value for classes
$( "#auto_c" ).autocomplete( "option", "classes.ui-autocomplete", sel );// sel is the variable
delay
Type : integer Default value300
Time dealy in miliseconds between keystroke and filter is applied. Less delay setting mean frequent change in menu ( better for local data) . High delay setting is good for remote data ( less responsive )
$( '#auto_c' ).autocomplete({
delay: 200
});
To get value of delay
var status_used = $( "#auto_c" ).autocomplete( "option", "delay" );
To set value for delay
$( "#auto_c" ).autocomplete( "option", "delay", sel );// sel is the variable
disabled
Type : boolean Default valuefalse
disable the autocomplete if set to true
$( '#auto_c' ).autocomplete({
disabled: true
});
To get value of disabled
var status_used = $( "#auto_c" ).autocomplete( "option", "disabled" );
To set value of disabled
$( "#auto_c" ).autocomplete( "option", "disabled", sel );// sel is the boolean variable
minLength
Type : Integer Default value1
User must type minimum number of chars before the filter ( search ) as applied, for a large number of items it is better to keep a higher value. For local data or less data we can keep it minimum or zero.
$( '#auto_c' ).autocomplete({
minLength: 2
});
To get value of minLength
var status_used = $( "#auto_c" ).autocomplete( "option", "minLength" );
To set value for minLength
$( "#auto_c" ).autocomplete( "option", "minLength", sel );// sel is the variable
var option_obj = $( "#auto_c" ).autocomplete( "option" );
Using this object we can display option values ( name : value ) in this demo.
search
Triggers search event on autocomplete element.
$( "#auto_c" ).autocomplete( "search",search_string ); // search_string is a variable
We can pass the search string and get the filtered options in menu.
We will use radio buttons to pass pre-set search string to autocomplete element.
If we send blank string then we must set option minLength:0
widget
We can get juqery object containing menu element.
$( "#auto_c" ).autocomplete( "widget" );
Events
change
Triggers when autocomplete input is blured ( when focus moves out ).