the following is the working code of algolia autocomplete, please help me how I can use it with the bootstrap tag input plugin or any other similar jquery autocomplete, i tried same with jquery tagit plugin and still couldn't solve it
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Algolia| Autocomplete</title>
</head>
<body>
<div class="container">
<div class="aa-input-container" id="aa-input-container">
<input type="search" id="tags" class="tags" placeholder="Search with algolia..." name="search"
autocomplete="off" />
</div>
</div>
<script src="https://cdn.jsdelivr.net/algoliasearch/3/algoliasearch.min.js"></script>
<script src="https://cdn.jsdelivr.net/autocomplete.js/0/autocomplete.min.js"></script>
<script>
(function() {
let client = algoliasearch('algolia-app-id', 'algolia-app-key');
let index = client.initIndex('tags');
let enterPressed = false;
//initialize autocomplete on search input (ID selector must match)
autocomplete('#tags',
{ hint: false }, {
source: autocomplete.sources.hits(index, { hitsPerPage: 10 }),
//value to be displayed in input control after user's suggestion selection
displayKey: 'name',
//hash of templates used when rendering dataset
templates: {
//'suggestion' templating function used to render a single suggestion
suggestion: function (suggestion) {
console.log(suggestion)
const markup = `
<div class="algolia-details">
<span>${suggestion.name}</span>
</div>
`;
return markup;
},
empty: function (result) {
return 'Sorry, we did not find any results for "' + result.query + '"';
}
}
}).on('autocomplete:selected', function (event, suggestion, dataset) {
console.log(suggestion);
})
})();
</script>
</body>
</html>
Finally here I found a solution