commit
5208fb2e35
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))) {
|
||||||
|
let select = autocomplete(target, options, [source(url)]);
|
||||||
select.on('autocomplete:selected', ({ target }, suggestion) => {
|
select.on('autocomplete:selected', ({ target }, suggestion) => {
|
||||||
$(target).trigger('autocomplete:select', suggestion);
|
$(target).trigger('autocomplete:select', suggestion);
|
||||||
select.autocomplete.setVal(suggestion.label);
|
select.autocomplete.setVal(suggestion.label);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue