Back
This example shows a multi-select autocomplete with tags positioned inline and a clear button using Ajax to fetch data.
const skillAutocomplete = new AvalynxAutocomplete('#skillSearch', {
fetchData: async (query) => {
const response = await fetch('php/result.php?type=skills&search=' + encodeURIComponent(query));
return await response.json();
},
maxSelections: 5,
tagsPosition: 'inline',
clearStyle: 'button',
onChange: (keys, values) => console.log('Skills:', keys, values)
}, {
placeholder: 'Add skills (max. 5)...',
noResults: 'No skills found',
removeTitle: 'Remove'
});
AvalynxAutocomplete on GitHub Avalynx on GitHub