2
0
mirror of https://github.com/devbridge/jQuery-Autocomplete.git synced 2024-11-26 06:46:32 +00:00

Update src/jquery.autocomplete.js

Need an element to store the data. 
So we define the id of we want to store the element. 
If be change in autocomplete, the element id will be cleaned.
If be choice in autocomplete, the element id will be set.
This commit is contained in:
Sinan AKYAZICI 2012-09-16 07:42:00 +03:00
parent 25d8b8fadd
commit cc57821b0a

View File

@ -45,7 +45,8 @@
params: {},
fnFormatResult: fnFormatResult,
delimiter: null,
zIndex: 9999
zIndex: 9999,
valueElementId=''
};
this.initialize();
this.setOptions(options);
@ -212,6 +213,7 @@
},
onValueChange: function () {
$("#" + this.options.valueElementId).val('');
clearInterval(this.onChangeInterval);
this.currentValue = this.el.val();
var q = this.getQuery(this.currentValue);
@ -417,6 +419,7 @@
s = me.suggestions[i];
d = me.data[i];
me.el.val(me.getValue(s));
$("#" + me.options.valueElementId).val(me.getValue(d));
if ($.isFunction(fn)) { fn(s, d, me.el); }
},