Giter Site home page Giter Site logo

inputtags-jquery-plugin's Introduction

inputTags.js

Presentation

inputTags.js is a simple jQuery plugin allowing to add, edit or remove tags in a tags list.

Installation

Make sure you include the script after the jQuery library.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="/path/to/inputTags.jquery.js"></script>

Getting started

Setting up inputTags.js is very easy. You just have to add this few lines below and that's it !

HTML:

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

JS:

$('#tags').inputTags();

Basic usage

Initialize plugin with custom tags Allows you to add custom tags on plugin initialization.

$('#tags').inputTags({
  tags: ['jQuery', 'tags', 'plugin'] // Custom tags list
});

Advanced usage

Initialize plugin with tags autocomplete Allows you to add a custom list from which the user can choose one or more tags.

$('#tags').inputTags({
  autocomplete: {
    values: ['Pellentesque', 'habitant', 'morbi', 'tristique', 'senectus'] // autocomplete list
  }
});

Methods

Coming soon...

Events

Add events listener on plugin initialization

$('#tags').inputTags({
    init: function($elem) {
      console.log('Event called on plugin init', $elem);
    },
    create: function() {
      console.log('Event called when an item is created');
    },
    update: function() {
      console.log('Event called when an item is updated');
    },
    destroy: function() {
      console.log('Event called when an item is deleted');
    },
    selected: function() {
      console.log('Event called when an item is selected');
    },
    unselected: function() {
      console.log('Event called when an item is unselected');
    },
    change: function($elem) {
      console.log('Event called on item change', $elem);
    }
});

**Add events after plugin initialization** ```js $('#tags').inputTags().on('change', function($elem) { console.log('Event called on item change', $elem); }); ``` same as: ```js $('#tags').inputTags('event', 'change', function($elem) { console.log('Event called on item change', $elem); }); ```

inputtags-jquery-plugin's People

Contributors

betaweb avatar

Watchers

 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.