Javascript AJAX AutoComplete Plugin | Cndk.AutoComplete.js

Cndk.AutoComplete.js is a JavaScript plugin. It performs autocomplete operations inside INPUT. Displays an autocomplete list containing suggestions that match what you typed into the autocomplete input.

best javascript autocomplete, jquery autocomplete with ajax, multiselect autocomplete javascript, inline autocomplete javascript

Features:

  • Load data from a JSON file
  • Preload data
  • Or download data upon request
  • View custom data
  • Dark and light themes
  • And much more…

Read More: Simple Accessible Autocomplete With Asynchronous Data Fetch for Vanilla Javascript

How to make use of it:

1. Load the Cndk Autocomplete library.

<link href="/cndk.autocomplete.css" rel="stylesheet" />
<script src="/cndk.autocomplete.js"></script>

2. Define your personal information for the autocomplete in a JSON file.

// data.json
[
  {
      "text": "Germany",
      "id": "2",
      "flag": "/de/flat/32.png",
      "code": "+144"
  },
  {
      "text": "Belgium",
      "id": "4",
      "flag": "/be/flat/32.png",
      "code": "+32"
  },
  {
      "text": "Brazil",
      "id": "5",
      "flag": "/br/flat/32.png",
      "code": "+55"
  },
  // ...
]

3. Attach the autocomplete to an input field you specify and decide how the info is rendered as follows:

<input type="text" id="example" name="country" placeholder="Search" autofocus="" />
var autoComplete = new CndkAutoComplete(
    {
      input: '#example',
      ajaxFile: '/path/to/data/.json',
      itemLayout: '<img style="width:15px;" src="${flag}"/> ${text} (<em>${code}</em>)',
      itemInputLayout: '${code}',
    }
);

4. By default, the library preloads JSON information on web page load.

var autoComplete = new CndkAutoComplete(
    {
      input: '#example',
      ajaxFile: '/path/to/data/.json',
      itemLayout: '<img style="width:15px;" src="${flag}"/> ${text} (<em>${code}</em>)',
      itemInputLayout: '${code}',
      type: 'dynamic',
    }
);

5. All default choices.

var autoComplete = new CndkAutoComplete(
    {

      // input selector
      input: '', 

      // path to JSON
      ajaxFile: '',

      // or 'dynamic'
      type: 'static',

      // min number of characters to trigger the autocomplete
      minCharsToSearch: 1, 

      // number of items to show on the suggestion list
      itemsShow: 5, 

      // auto focus the input when any item has been selected
      autoFocusWhenSelect: null,

      // disable the input if any item has been selected
      disableInputOnSelect: false,

      // show all items when value length = 0 and options is = true
      showAllOnInputClick: true,

      // submit the form when pressing Enter key
      submitFormOnEnter: false, 

      // submit the form when any item has been selected
      submitFormOnItemSelect: false,

      // $text | $id
      submitValueType: '${id}',

      // $id | $text | $url ...
      itemLayout: '${text}', 

      // $id | $text | $url ...
      itemInputLayout: '${text}',

      // root ID
      rootDivId: "cndkAutoComplete",

      // item class
      itemClass: 'cndk-item',

      // active item class
      itemClassActive: 'cndk-item-active',

      // or 'dark'
      theme: 'light',

    }
);

Fast AJAX Autocomplete JavaScript Library, Cndk.AutoComplete.js Plugin/Github, autocomplete api js


See Demo And Download

Official Website(ilkerccom): Click Here

This superior jQuery/javascript plugin is developed by ilkerccom. For extra Advanced Usages, 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…