Fix autocomplete
This commit is contained in:
parent
358637adde
commit
3d506a8cdc
1 changed files with 7 additions and 5 deletions
|
@ -38,10 +38,12 @@ function source(url) {
|
||||||
|
|
||||||
addEventListener('turbolinks:load', function() {
|
addEventListener('turbolinks:load', function() {
|
||||||
for (let { type, url } of sources) {
|
for (let { type, url } of sources) {
|
||||||
let select = autocomplete(selector(type), options, [source(url)]);
|
for (let target of document.querySelectorAll(selector(type))) {
|
||||||
select.on('autocomplete:selected', ({ target }, suggestion) => {
|
let select = autocomplete(target, options, [source(url)]);
|
||||||
$(target).trigger('autocomplete:select', suggestion);
|
select.on('autocomplete:selected', ({ target }, suggestion) => {
|
||||||
select.autocomplete.setVal(suggestion.label);
|
$(target).trigger('autocomplete:select', suggestion);
|
||||||
});
|
select.autocomplete.setVal(suggestion.label);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue