Autocomplete.js
A simple pure vanilla Javascript library that's built for speed, high versatility and seamless integration with wide range of projects & systems. Autocomplete is included in this template via the Vendor Files.
const autoCompleteJS = new autoComplete({
selector: "#autoComplete",
placeHolder: "Search for Food...",
data: {
src: ["Sauce - Thousand Island", "Wild Boar - Tenderloin", "Goat - Whole Cut", "Pizza", "Water", "Burger", "Shawarma", "Fries", "Chicken", "Beef", "Pasta", "Rice", "Noodles", "Salad", "Soup", "Sandwich", "Bread", "Egg", "Cheese", "Milk", "Butter", "Yogurt", "Ice Cream", "Chocolate", "Cake", "Biscuit", "Cookie", "Donut", "Candy", "Pudding", "Pie", "Pancake", "Waffle", "Bacon", "Sausage", "Ham", "Hot Dog", "Meat", "Fish", "Shrimp", "Crab", "Lobster", "Oyster", "Clam", "Mussel", "Squid", "Octopus", "Snail", "Jellyfish", "Seaweed"],
cache: true,
},
resultsList: {
element: (list, data) => {
if (!data.results.length) {
// Create "No Results" message element
const message = document.createElement("div");
// Add class to the created element
message.setAttribute("class", "no_result");
// Add message text content
message.innerHTML = `Found No Results for "${data.query}"`;
// Append message element to the results list
list.prepend(message);
}
},
noResults: true,
},
resultItem: {
highlight: true
},
events: {
input: {
selection: (event) => {
const selection = event.detail.selection.value;
autoCompleteJS.input.value = selection;
}
}
}
});
<button type="button" class="btn btn-primary" id="liveToastBtn">Show live toast</button>
<div class="toast-container position-fixed bottom-0 end-0 p-3">
	<div id="liveToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
		<div class="toast-header">
			<img src="..." class="rounded me-2" alt="...">
			<strong class="me-auto">Bootstrap</strong>
			<small>11 mins ago</small>
			<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
		</div>
		<div class="toast-body">
			Hello, world! This is a toast message.
		</div>
	</div>
</div>