mirror of
https://github.com/devbridge/jQuery-Autocomplete.git
synced 2024-12-01 17:23:59 +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:
parent
25d8b8fadd
commit
cc57821b0a
@ -45,7 +45,8 @@
|
|||||||
params: {},
|
params: {},
|
||||||
fnFormatResult: fnFormatResult,
|
fnFormatResult: fnFormatResult,
|
||||||
delimiter: null,
|
delimiter: null,
|
||||||
zIndex: 9999
|
zIndex: 9999,
|
||||||
|
valueElementId=''
|
||||||
};
|
};
|
||||||
this.initialize();
|
this.initialize();
|
||||||
this.setOptions(options);
|
this.setOptions(options);
|
||||||
@ -212,6 +213,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
onValueChange: function () {
|
onValueChange: function () {
|
||||||
|
$("#" + this.options.valueElementId).val('');
|
||||||
clearInterval(this.onChangeInterval);
|
clearInterval(this.onChangeInterval);
|
||||||
this.currentValue = this.el.val();
|
this.currentValue = this.el.val();
|
||||||
var q = this.getQuery(this.currentValue);
|
var q = this.getQuery(this.currentValue);
|
||||||
@ -417,6 +419,7 @@
|
|||||||
s = me.suggestions[i];
|
s = me.suggestions[i];
|
||||||
d = me.data[i];
|
d = me.data[i];
|
||||||
me.el.val(me.getValue(s));
|
me.el.val(me.getValue(s));
|
||||||
|
$("#" + me.options.valueElementId).val(me.getValue(d));
|
||||||
if ($.isFunction(fn)) { fn(s, d, me.el); }
|
if ($.isFunction(fn)) { fn(s, d, me.el); }
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user