Giter VIP home page Giter VIP logo

jquery-multiautocomplete's Introduction

jQuery-multiAutocomplete

A jQuery plugin that allows multiple autocompletes in a input.

License: MIT GitHub last commit GitHub tag GitHub created GitHub size js GitHub size css

Read this in other languages: Portuguese.

Demonstration

Compatibility

jQuery-multiAutocomplete has been tested with jQuery 1.7+ on major browsers:

  • Chrome 45+
  • Firefox 22.7+
  • Safari 10+
  • Edge 12+
  • Opera 28+
  • IE (not suported)

CDN

jsDelivr

Supported options

Option Default Description
delimiters ' ' (a whitespace) This option accepts characters in string format. These characters will define the beginning of a new suggestion. Must be described in sequence to each other (e.g. '\n ').
minChunkSize 1 Number of minimum characters typed, so that suggestions are displayed. This option has no effect if the prefixRegexps is not with the value described in the Default column
autosuggest true It allows updating suggestions in real time. If false is set, it will be necessary to use Ctrl+Space or โŒ˜ Command+Space to display the suggestions.
endingSymbols '' (a empty string) This option accepts a set of characters (string), which will be concatenated to a suggestion, after selecting it (e.g. ', ').
prefixRegexps /.*/ This option accepts only regular expressions. It specifies the mandatory prefix to be entered, so that suggestions start to appear.
stopSuggestionKeys [9, 13] This option accepts only one array of elements. Keys that will be pressed to confirm the choice of a suggestion. By default, the keys are Tab or Enter.
ignoreCase false Case sensitive enabled by default. If you want to make case insensitive, just set it to true.
maxShowSuggestion 10 Maximum number of suggestions visible at a time in the list of suggestions.

Supported methods

jQuery-multiAutocomplete has a only two methods:

  • init(suggests, options): initializes the multiAutocomplete instance. If it has already been initialized before for the same jQuery object, the instance will have its events unbind and bind again. The suggests parameter are one array of strings and options are described above.
  • destroy: all events are unbind of the jQuery object.

Theses methods can be invoked in two ways. One of them is to pass a string with the method name, as soon as you call the multiAutocomplete instance. The other option is to call the instance without a parameter and then invoke the method.

$('#suggests').multiAutocomplete(['foo', ..., 'bar'], options);
$('#suggests').multiAutocomplete('destroy');
// Or
$('.suggests').multiAutocomplete().init(['foo', ..., 'bar']);
$('#suggests').multiAutocomplete().destroy();

Examples

HTML:

<input class='form-control' id='suggests' type='text'>

JavaScript:

let suggests = ['foo', 'foo.bar', 'foo.bar[0]', 'bar', 'bar.foo'];

// Basic Usage, only passing array of suggestions
$('#suggests').multiAutocomplete(suggests);

$('#suggests').multiAutocomplete(suggests, {
    // Only after typing "foo" or "bar", suggestions appeared
    prefixRegexps: /(foo|bar)/,
    // Are necessary press Ctrl+Space or Command+Space to see the suggestions
    autosuggest: false
});

Support

Just open an Issue and I will meet you. https://github.com/IsraelFM/jQuery-multiAutocomplete/issues

jquery-multiautocomplete's People

Contributors

israelfm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.