Simple and Fast Autocomplete and Typeahead Javascript Library | autoComplete.js

autoComplete.js is a simple, pure, and incrementally designed JavaScript library for speed, high versatility, and seamless integration with a wide variety of projects and systems.

Features

  • Pure Vanilla Javascript
  • Zero Dependencies
  • Simple & Lightweight
  • Powerful Search Engine with two different modes
  • Diacritics Support
  • Debounce Support
  • Life Cycle Events
  • Useful plugin API
  • WAI-ARIA Compliant
  • Highly Customizable
  • Works on anything (<input><textarea> and contentEditable elements)
  • Well Documented

Must Read: [Bootstrap 5] Autocomplete Functionality for Input Fields in Vanilla Javascript

Autocomplete-and-Typeahead-Javascript-Library

How to make use of it:

1. Installation:

npm i @tarekraafat/autocomplete.js

2. CDN Code:

<script src="https://cdn.jsdelivr.net/npm/@tarekraafat/[email protected]/dist/autoComplete.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tarekraafat/[email protected]/dist/css/autoComplete.min.css">

3. Add an <input> or <textarea> tag to your html page:

<input id="autoComplete">

<!-- OR -->

<textarea id="autoComplete">

4. Import the autoComplete.js library into your project.

<script src="https://cdn.jsdelivr.net/npm/@tarekraafat/[email protected]/dist/autoComplete.min.js"></script>

5. Set the autoComplete.js instance configurations:

// API Basic Configuration Object
{
    placeHolder: "Search for Food...",
    data: {
        src: ["Sauce - Thousand Island", "Wild Boar - Tenderloin", "Goat - Whole Cut"]
    },
    resultItem: {
        highlight: true,
    }
}

data (required)

Responsible for the data source selection

  • Type: Object
Methods:

src (required)

  • Type: Array|Function returns Array of results values
    • Parameters: (query(Only works if data.cache is false)
  • Default: null

keys (required)

  • Type: Array (Only required if data.src is Array of Objects)
  • Default: null

Must Read: Select With Autocomplete Slots Bootstrap Material Design Themes

cache (optional)

  • Type: Boolean
  • Default: false

filter (optional)

  • Type: Function returns Array of results values
    • Parameters: (list)
  • Default: No action

Events

Responsible for the input field and results list events additions or overriding

  • Type: Object
    • input: Object of functions with the event type name
    • list: Object of functions with the event type name
  • Default:
    • input: keydown and blur
    • list: mousedown and click

search(query, record, options)

autoComplete.js powerful search engine

  • query: String
  • record: String
  • options: Object(optional)
    • mode: String
      • "strict" search mode
      • "loose" search mode
    • diacritics: Boolean
    • highlight: Boolean | String of class values

Defaults:

Must Read: Autocomplete/Typeahead JS Plugin For Bootstrap v5

Arguments:

  • options: Object
    • mode: "strict"
    • diacritics: false
    • highlight: false

See Also –

Angular ng Material Autocomplete Validation Plugin Library
Progressive and Customizable Autocomplete JavaScript Library | horsey.js
Mention Autocomplete Tag Input Plugin Using JavaScript


See Demo And Download

Official Website(TarekRaafat): Click Here

This superior jQuery/javascript plugin is developed by TarekRaafat. For extra Advanced Usage, please go to the official website.

Related Posts

Input-Values-Using-Mouse-Drag

Create Side Sliders Input Values Using Mouse Drag | Pointer Lock

HTML Range Slider is a lightweight library to create side sliders to adjust values easily and precisely by making use of the Pointer Lock API. Side Slider…

simple-parallax-scrolling-js

Smooth and Lightweight Parallax Scroll Library in Pure Javascript

Lightweight and seamless parallax scrolling library implemented in pure javascript using hardware acceleration for additional performance. Main Features Extremely lightweight with no dependencies A few kilobytes of pure…

Convert-Form-Data-to-JSON

How to Convert Form Data to JSON with HTML Forms | FormsJS

FormsJS is a simple-to-use JavaScript library that covers type subject values to JSON in real time. The items containing the data category will be analyzed automatically. It…

editable-html-table-using-javascript

A Small jQuery Extension to Convert An Editable HTML Table

Editable Table is a small jQuery extension to convert an editable HTML table for fast data entry and validation. A small jQuery extension to convert a static…

jquery.youtube-background

Simple jQuery Plugin for Embedding YouTube Videos As Cover Background

jquery.youtube-background is a jQuery plugin built to facilitate YouTube embeds as cover wallpaper using the YouTube Embed API. There is another jQuery Youtube Video Background plugin that…

Data-Table-Generator-Tabulator

Interactive Data Table Generator with JS/jQuery and JSON | Tabulator

Tabulator allows you to create interactive tables in seconds from any HTML Table, JavaScript array, AJAX data source, or JSON format data. Just include the library in your…