GithubHelp home page GithubHelp logo

isaacmiliani / select2-customselectionadapter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from andreivictor/select2-customselectionadapter

0.0 1.0 0.0 137 KB

An implementation of a custom selection adapter for the Select2 plugin (v4) - multiple mode. Displays the selected tags into a separate section, leaving the search box empty.

Home Page: https://andreivictor.github.io/select2-customSelectionAdapter/

License: MIT License

JavaScript 88.99% CSS 11.01%

select2-customselectionadapter's Introduction

select2-customSelectionAdapter

An implementation of a custom selection adapter for the Select2 plugin (v4) - multiple mode. Displays the selected tags into a separate section, leaving the search box empty.

img

Demo

https://andreivictor.github.io/select2-customSelectionAdapter/.

Usage

Initialize the select2 plugin with the selectionAdapter option.

var CustomSelectionAdapter = $.fn.select2.amd.require("select2/selection/customSelectionAdapter");

$("select").select2({
    // options 
    selectionAdapter: CustomSelectionAdapter
});

Setup

Include the script after Select2 main javascript file:

<script src="select2.js"></script>
<script src="select2.customSelectionAdapter.min.js"></script>

Include the css file:

<link rel="stylesheet" href="select2.customSelectionAdapter.css" />

selectionContainer Option

By default, the tags are added immediately after the select2 container. You can use the selectionContainer option to add them somewhere else in the page.

var CustomSelectionAdapter = $.fn.select2.amd.require("select2/selection/customSelectionAdapter");

$("select").select2({
    // options 
    selectionAdapter: CustomSelectionAdapter,
    selectionContainer: $('.foo')
});

Select2 compatibility

  • Select2 4+

Copyright and license

The license is available within the repository in the LICENSE file.

select2-customselectionadapter's People

Contributors

andreivictor avatar dependabot[bot] avatar gareth-ib 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.