Flat jQuery Tags Input Plugin with Autocomplete inputTags - Download Flat jQuery Tags Input Plugin with Autocomplete - inputTags

Download Flat jQuery Tags Input Plugin with Autocomplete – inputTags

Posted on

This time I will share jQuery Plugin and tutorial about Flat jQuery Tags Input Plugin with Autocomplete – inputTags, hope it will help you in programming stack.

Flat jQuery Tags Input Plugin with Autocomplete inputTags - Download Flat jQuery Tags Input Plugin with Autocomplete - inputTags
File Size: 17.6 KB
Views Total: 6425
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

inputTags is a pretty, flat style jQuery tags input plugin which allows you to manage tags in a text input with support for autocomplete and tags validation.

How to use it:

1. Load the inputTags.css in the header for default plugin styles.

1 <link rel="stylesheet" href="css/inputTags.css">

2. Create a text field for the tags input.

1 <input type="text" id="tags">

3. Load jQuery library and the inputTags.js at the bottom of the webpage.

1 <script src="jquery.min.js"></script>
2 <script src="js/inputTags.jquery.js"></script>

4. Initialize the plugin with a list of predefined tags.

1 $('#tags').inputTags({
2   tags: ['jQuery', 'JavaScript']
3 });

5. Add an array of tags for the autocomplete list that displays the rest of tags when a user is typing.

1 $('#tags').inputTags({
2   autocomplete: {
3     values: ['jQuery', 'JavaScript']
4   }
5 });

6. More configuration options.

01 // an array of tags
02 tags: [],
03 keys: [],
04  
05 // for tags validation
06 minLength: 2,
07 maxLength: 30,
08 max: 6,
09  
10 // Events
11 init: false,
12 create: false,
13 up<a href="https://www.jqueryscript.net/time-clock/">date</a>: false,
14 destroy: false,
15 focus: false,
16 selected: false,
17 unselected: false,
18 change: false,
19  
20 // editable
21 editable: true,
22  
23 // for autocomplete list
24 autocomplete: {
25   values: [],
26   only: false
27 },
28  
29 // custom error messages
30 errors: {
31   empty: 'Attention, vous ne pouvez pas ajouter un tag vide.',
32   minLength: 'Attention, votre tag doit avoir au minimum %s caractères.',
33   maxLength: 'Attention, votre tag ne doit pas dépasser %s caractères.',
34   max: 'Attention, le nombre de tags ne doit pas dépasser %s.',
35   exists: 'Attention, ce tag existe déjà !',
36   autocomplete_only: 'Attention, vous devez sélectionner une valeur dans la liste.',
37   timeout: 8000
38 }

7. Events.

01 $('#tags').inputTags({
02   init: function($elem) {
03     console.log('Event called on plugin init', $elem);
04   },
05   create: function() {
06     console.log('Event called when an item is created');
07   },
08   update: function() {
09     console.log('Event called when an item is updated');
10   },
11   destroy: function() {
12     console.log('Event called when an item is deleted');
13   },
14   selected: function() {
15     console.log('Event called when an item is selected');
16   },
17   unselected: function() {
18     console.log('Event called when an item is unselected');
19   },
20   change: function($elem) {
21     console.log('Event called on item change', $elem);
22   }
23 });

Changelog:

2016-07-28

  • Update CSS and JS

2016-07-27

  • Fix autocomplete issue

2015-10-19

  • Fix default values issue + add autocompleteTagSelect event

2015-10-14

  • Add default input values check

2015-08-17

  • Fix custom tags fill issue

This awesome jQuery plugin is developed by betaWeb. For more Advanced Usages, please check the demo page or visit the official website.

source : jquery.net