Categories: CSSScriptWeb Design

Easy Autocomplete Library For Bootstrap 5 – autocompleteBS

A simple and configurable autocomplete JavaScript library created especially for the latest Bootstrap 5 framework.

Table of Contents

Toggle

How to use it:

1. Load the autocompleteBS.css and autocompleteBS.js in your Bootstrap 5 project.

<!-- Bootstrap 5 Framework -->
<link rel="stylesheet" href="/path/to/cdn/bootstrap.min.css" />
<script src="/path/to/cdn/bootstrap.bundle.min.js"></script>
<!-- autocompleteBS fikes -->
<link rel="stylesheet" href="/path/to/css/autocompleteBS.css" />
<script src="/path/to/js/autocompleteBS.js"></script>

2. Enable the autocomplete functionality on an input field and specify the data source from which the library fetches data for suggestions.

<input

Sponsored
type="text" class="form-control" id="inputText" />
autocompleteBS({
  name: 'Select A Country by Name',
  inputSource: document.getElementById('inputText'),
  fetchURL: 'https://restcountries.eu/rest/v2/capital/{term}',
  fetchMap: {
    id: "alpha2Code",
    name: "name"
  }
});

3. Output the result in another input field.

autocompleteBS({
  inputSource: document.getElementById('inputText'),
  targetID: document.getElementById('anotherInput'),
});

4. Set the minimum number of characters to trigger the autocomplete.

autocompleteBS({
  minLength: 2
});

5. Set the maximum number of results displayed in the suggestion list.

Sponsored
autocompleteBS({
  maxResults: 10
});

Changelog:

08/25/2025

  • autoselect single entries

08/05/2021

  • select parent element when target is not a div

04/17/2021

  • choose first on enter

The post Easy Autocomplete Library For Bootstrap 5 – autocompleteBS appeared first on CSS Script.

rssfeeds-admin

Share
Published by
rssfeeds-admin

Recent Posts

Netflix isn’t buying Warner Bros: all of the latest updates

Just months after Netflix struck a deal to acquire the Warner Bros. studio, HBO, HBO…

21 minutes ago

TCL’s $7,000+ flagship TV is ready to fight

The TCL X11L is the most impressive TV of the year, but the year is…

21 minutes ago

Pokémon Presents 2026: All the news and trailers

It’s that time of year: A whole bunch of Pokémon news is incoming. February 27th…

21 minutes ago

A Look Back, Feb. 27

50 Years Ago Coeducation appears to be settling in quietly at Amherst College these days,…

39 minutes ago

South Hadley considers override to avoid severe cuts to schools and services

SOUTH HADLEY — Facing a $3.5 million fiscal cliff that threatens to shutter libraries and…

39 minutes ago

Worthington voters back solar moratorium, approve K-9 funding at special TM

WORTHINGTON — Residents packed the RH Conwell Elementary School Tuesday night and overwhelmingly approved all…

39 minutes ago

This website uses cookies.