All Projects → Honatas → Bootstrap 4 Autocomplete

Honatas / Bootstrap 4 Autocomplete

Licence: mit
A simple autocomplete/typeahead for Bootstrap 4 and jQuery

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to Bootstrap 4 Autocomplete

Raytools
A very simple lightweight jQuery Data Grid table that uses jQuery & Bootstrap.
Stars: ✭ 5 (-86.11%)
Mutual labels:  bootstrap, jquery
Ax5ui Uploader
jQuery file uploader, HTML5(IE9+, FF, Chrome, Safari) - http://ax5.io/ax5ui-uploader/
Stars: ✭ 25 (-30.56%)
Mutual labels:  bootstrap, jquery
Reactjs Tmdb App
Responsive React 'The Movie Database' (TMDb) App
Stars: ✭ 830 (+2205.56%)
Mutual labels:  typeahead, bootstrap
React Bootstrap Typeahead
React typeahead with Bootstrap styling
Stars: ✭ 773 (+2047.22%)
Mutual labels:  typeahead, bootstrap
Bootstrap
Open Source JS plugins
Stars: ✭ 13 (-63.89%)
Mutual labels:  bootstrap, jquery
Tableexport
The simple, easy-to-implement library to export HTML tables to xlsx, xls, csv, and txt files.
Stars: ✭ 781 (+2069.44%)
Mutual labels:  bootstrap, jquery
Learningprocess
💥 本仓库用于记录我的学习历程和学习笔记
Stars: ✭ 31 (-13.89%)
Mutual labels:  bootstrap, jquery
Selectpage
A simple style and powerful selector, including ajax remote data, autocomplete, pagination, tags, i18n and keyboard navigation features
Stars: ✭ 679 (+1786.11%)
Mutual labels:  autocomplete, jquery
Librecms
Free Open Source Content Management System, based on PHP, Bootstrap and jQuery.
Stars: ✭ 12 (-66.67%)
Mutual labels:  bootstrap, jquery
Bootstrap Msg
The jQuery plugin for showing message with Bootstrap alert classes
Stars: ✭ 10 (-72.22%)
Mutual labels:  bootstrap, jquery
Gridstrap.js
gridstrap.js is a jQuery plugin designed to take Bootstrap's CSS grid system and turn it into a managed draggable and resizeable grid while truely maintaining its responsive behaviour.
Stars: ✭ 32 (-11.11%)
Mutual labels:  bootstrap, jquery
Ecommerce
We're going to take you step-by-step to build a modern, fully open-source, eCommerce web application using Python, Django, Bootstrap, Javascript, and more.
Stars: ✭ 980 (+2622.22%)
Mutual labels:  bootstrap, jquery
Inspinia
This is only a copy of INSPINIA - Responsive Admin Theme
Stars: ✭ 755 (+1997.22%)
Mutual labels:  bootstrap, jquery
Hospital Management System
"Health Care hospital" Management System is designed for manage details about hospital patient,employee and rooms(10). Designed by using HTML / CSS / JS / JQUERY/ PHP (procedural php) / MYSQL.
Stars: ✭ 5 (-86.11%)
Mutual labels:  bootstrap, jquery
Javaquarkbbs
基于Spring Boot实现的一个简易的Java社区
Stars: ✭ 755 (+1997.22%)
Mutual labels:  bootstrap, jquery
Autosuggest Trie
Minimalistic trie implementation for autosuggest and autocomplete components
Stars: ✭ 22 (-38.89%)
Mutual labels:  autocomplete, typeahead
React Autosuggest
WAI-ARIA compliant React autosuggest component
Stars: ✭ 5,773 (+15936.11%)
Mutual labels:  autocomplete, typeahead
Mobirise
Free Website Builder for Bootstrap 4 & AMP
Stars: ✭ 664 (+1744.44%)
Mutual labels:  bootstrap, jquery
Metro Ui Css
Impressive component library for expressive web development! Build responsive projects on the web with the first front-end component library in Metro Style. And now there are even more opportunities every day!
Stars: ✭ 6,843 (+18908.33%)
Mutual labels:  bootstrap, jquery
Ruoyi
(RuoYi)官方仓库 基于SpringBoot的权限管理系统 易读易懂、界面简洁美观。 核心技术采用Spring、MyBatis、Shiro没有任何其它重度依赖。直接运行即可用
Stars: ✭ 905 (+2413.89%)
Mutual labels:  bootstrap, jquery

Bootstrap 4 Autocomplete

Travis David GitHub npm typescript coffee

A very small (less than 2Kb) autocomplete/typeahead for Bootstrap 4 and jQuery.

It uses the default Dropdown component from Bootstrap 4 to create the list of autocomplete items.

Install

You can get it from npm:

npm install bootstrap-4-autocomplete

Or you can get it from a CDN. Just be careful to add it to your HTML AFTER Jquery, Popperjs and Bootstrap:

<!-- Dependencies -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" crossorigin="anonymous"></script>
<!-- Bootstrap 4 Autocomplete -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap-4-autocomplete/dist/bootstrap-4-autocomplete.min.js" crossorigin="anonymous"></script>

Typescript

If your project uses Typescript, Bootstrap 4 Autocomplete has type definitions. If for some reason your IDE/Compiler can't find the definitions automatically, you can add them manually on your tsconfig.json file in the "includes" section:

includes: ["node_modules/bootstrap-4-autocomplete/dist/bootstrap-4-autocomplete.d.ts"]

Usage

Take a look at this fiddle to get an overview of a simple usage.

Given you have a textfield with id "myAutocomplete", you can:

$("#myAutocomplete").autocomplete(options);

Options is a JSON object with the following attributes (in alphabetical order):

dropdownOptions:
It's the same options from Bootstrap's Dropdown, documented here.

dropdownClass:
The class of the dropdown-menu element, which is the box that is displayed. Can take a string or an array of strings.

highlightClass:
The class to use when highlighting typed text on items. Only used when highlightTyped is true. Default is text-primary. Can take a string or an array of strings.

highlightTyped:
Wether to highlight (style) typed text on items. Default is true.

label:
Where to find the label on your source. The label is what will be shown on each item in the autocomplete list.

maximumItems:
How many items you want to show when the autocomplete is displayed. Default is 5. Set to 0 to display all available items.

onSelectItem:
A callback that is fired every time an item is selected. It receives two parameters: the first is the selected item, the second is the textfield element. The selected item has the format:

{ value: value, label: label }  

Note that you don't have to use this callback to set the text in the textfield, this is done automatically.

source:
The data from where autocomplete will lookup items to show. This data has to be a JSON object. The default format for this object is:

{ "label1": 1, "label2": 2, ...}

If your JSON has this format, you don't need to set the label and value options, as they will be retrieved automatically. Otherwise, you can pass any format as you want, given you set the value and label options.

treshold:
The number of characters that need to be typed on the input in order to trigger the autocomplete. Default is 4.

value:
Where to find the value on your source.

How it works

When you call autocomplete on a texfield (also known as input type="text"), this lib builds a Dropdown around the textfield, having it's parent as the container. The textfield is then injected an onkeyup event that triggers the Dropdown when the length of the text typed is equal to or greater than the treshold. When this happens, the data is then filtered to get only the items that contain the text typed. When you activate one of the items, the textfield's value is set to that item's label.

Contributions

Feel free to open an issue or add a pull request. Anytime. Really, I mean it.

Also, if you like my work, I'll let you know that I love coffee. *wink wink nudge nudge*

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].