this is my jquery code.year is form input tag id.years is array variable it's contain all years values.i put this array in autocomplete source.it's working fine.but once i set autocomplete source equal null after set autocomplete source years array did not work.how to solve this problem?
$("#year").blur(function() {
var keyEvent = $.Event("keydown");
keyEvent.keyCode = $.ui.keyCode.ENTER;
$(this).trigger(keyEvent);
// Stop event propagation if needed
return false;
}).autocomplete({
autoFocus : true,
source : years,
selectFirst : true,
select : function(event, ui) {
variableyear = (ui.item.lable);
}
});
code for clear source data:
$("#year").autocomplete('option', 'source', null);