select 2 dropdown

Solutions on MaxInterview for select 2 dropdown by the best coders in the world

showing results for - "select 2 dropdown"
Jeffrey
25 Apr 2016
1$(".class").select2({
2    templateResult: formatState,
3    templateSelection: formatState
4});
5
6function formatState (opt) {
7    if (!opt.id) {
8        return opt.text.toUpperCase();
9    } 
10
11    var optimage = $(opt.element).attr('data-image'); 
12    console.log(optimage)
13    if(!optimage){
14       return opt.text.toUpperCase();
15    } else {                    
16        var $opt = $(
17           '<span><img src="' + optimage + '" width="60px" /> ' + opt.text.toUpperCase() + '</span>'
18        );
19        return $opt;
20    }
21};
22
Georgie
24 May 2018
1$('#element').select2({
2    placeholder: 'Select a option',
3    minimumInputLength: 3,
4    ajax: {
5        url: route('api.fetch-options'),
6        dataType: 'json',
7        type: 'GET',
8        quietMillis: 50,
9        data: function (params) {
10            return {
11                visitor_name: params.term
12            }
13        },
14        processResults({ data }) {
15            return {
16                results: $.map(data, function (item) {
17                    return {
18                        text: item.name,
19                        id: item.id,
20                    }
21                })
22            }
23        }
24    }
25}).change(() => {
26	// perform some action on change
27});
Harvey
10 Apr 2018
1var initQuantitiesDropdown = function () {
2    var options = [];
3    var selectedFruit = $("#fruits").val();
4    $.each(pageData.products[selectedFruit].quantities, function (key, value) {
5        options.push({
6            text: value,
7            id: key
8        });
9    })
10    $("#quantities").empty().select2({
11        data: options
12    });
13};
14
15$("#fruits").select2().change(initQuantitiesDropdown);
16initQuantitiesDropdown();
Alonso
28 Mar 2017
1//Installation
2<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/css/select2.min.css" rel="stylesheet" />
3<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/js/select2.min.js"></script>
4
5
6
7// In your Javascript (external .js resource or <script> tag)
8$(document).ready(function() {
9    $('.js-example-basic-single').select2();
10});
Simon
27 May 2016
1$(".js-example-basic-multiple-limit").select2({
2  maximumSelectionLength: 2
3});
queries leading to this page
select 2 dynamic option set from apihow implement multiple selectimage in select2 dropdownrails select2 add default option linkselect 2 select optionmultil select 2multiselect selct2 dropdownselect2 dropdown with custom imageshtml select with multiple dropdownsoption multiple selectmultiple select with select2tagging with multi value select boxes select2html select element multiselectmulti select select htmlselect2 4 0 multiplemaking multiple fields as multiselect select2select2 multi select cssselect2 image in optionselect2 multi select dropdownselect2 multi select select allmultiple select allexample select2 with jqueryselect 2 example dropdownselect2 dropdown 2select2 add multiple optionselect 2 demobasic single select dropdownhow to do multiple select using selectselect2 dropdown single selectselect 2 in form selectselect 2 htmlselect multiple options htmlselect multiple htmlselect2 option add imageselect 2 multiselect with searchselect2 multi selecthtml multiple selectmultiple select listselect multiple options in dropdowncheckbox multiple selectselect2 multipleselectselect 2 dropdown search and other buttonselect 2 multiselect dropdown exampledropdown multiple selectselect2 search fieldselect2 multylist with jsselect2 simple exampleadd image in select2 dropdownselect2 multi select examplehow to select2 apply in multiple select box in jqueryselect2 multiple select with tag inputselect2 button in dropdownselect2 dropdown exampleselect multiselect 2 in dropdown inputselect and multiselectmultiple select using select2selected option from several selectorsmulti select optionselect2 examplemultiple select dropdown htmlmulti level dropdown select 2multiple select dropdowns using multiselect jsinsert text in select2select2 multiple select 2 values 27select multi selectselect2 inputselect 2 select multiple with jshtml select several optionsmultiple selection dropdown select2multiselect dropdown with select allselect 2 dropdown classselect2editable using select2 dropdownselect all in multiselect select2how to use select2select multiple as dropdownmulti select in selectselect 2 select all multiplehtml multiple select dropdownmultiple select in select2select multiple 3d multiplehtml 3a select multiple as dropdownselect2 accept unkmnown valuesselect 2 multiselect with optionsselect2 dropdown ave same with than selecthtml multiple select anyonehtml select multiple elementshtml multiple select dropdown exampleselect 2 dropdownselect2 multiselect select a valuemultiselect dropdownselect all select multipleselect2 with multiselectdropdown list html with multiple selectselect multiple optionshow to select multiple items in multi selectselect 2 dropdown htmlmultiple select to select multiple select multipledrop down multiple selectionmultiple select element jquery select2select multiple elements with queryselectorhow to create select 2 demomultiple select queryselect all in multiselectselect2 multiple with tagdrop down select multiple options htmlhow ton include the select below is declared with the multiple attribute in multiselect tableselect 2 dropdown with imageselect 2 multiselect with checkbox optionsmulti select divselect2 js examplejs select2 multi selectselect multiple select javascriptmulti select with divmake item selected in edit page for select2 multiple dropdown jquerymultiselect one selected from 4select 2 dropdown jqueryselect 2 multiple selectmulti select with select2the select2 div is displayed only when the dropdown is downselect multiple dropdownselect2 multiple select all exampleselect 2 multiselect tagsmulti select select2selection multipleselect 2 dropdown dissapearsselect2 add image to selected valueusing select 2on select of input select multiple another selectdropdown multiple select in htmlbootstrap submit dropdown javascript select2multi level select with same level selectjquery select2 set valueselect2 custom form applicationmultiselect select fieldselect2 multiple dataselect2 allow new valuequeryselector select multipleselect 2 multiselectmultiple select option append in select2how to use multiple select using fselectsingle select 2select2 select all optionhow to select multiple in htmlselect2 multiple active selectionsselect multiple select allselect2 multiple select active selectionsselect type 2 multiple selectmultiple select bar in bootstrap in select 2 jsmultiselect optionselect multiple from dropdownhtml multiple select and show in dropdown example select2 multiple selectselect2 multiple select orderselect2 select multiple values in the dropdowndisplaying two select after added select2 classselect2 initialize multiple selectshow to initialize multi option select2 in jqueryselect multiple dropdown in htmlmultiple selects boxtwo select2 dropdown in one pageselect2 multiple dropdown in one viewmulti select 2 exampleget more than one information with select2select multiple html select 2 multiselect selected jqueryselect multi selectmanually add an option in select 2 multiple select2 jqueryselect2 exemplesdifference between class select2 and function select2multiple select demoreplace select2 optionsselect2 replace options select2 multiselect with checkboxmultiple 3d multiple select2multiple html selectcombobox multiselectselect2 text inputmulti selectableselect2 dropdowndisplay an option having multiple things in multiselect dropdownselect2 dropdown multiselect multiple select in one querymultiple select optionselect multiple options in dropdown multiselect javascriptselect2 dropdown option in two partsselect2 tutorialselect 2 choosemultiple select2 dropdown in one pagejquery select2 demoselect multiplehtml multi select selectedselectric multiple selecthtml select 2select2 tagging exampledisplay image in select2 dropdownmultiselect 2 htmlselect2 how to demomultiselect select2js ready vs select2required select2 with multiple arrayhow to add an image in select2 optionsselect 2 dropdown belowselect2 multiple select examplehtml select list select multiplechange options on change select2 select2 multi select documentationselect multiple options from dropdownselect 2 codedropdown multiple select htmlselect 2 multiselect gave defult one selectionselect2 js multiple option selecteddropdown multiselect with selected orderselect 2 fieldselect2 multiselect widget exampleselect2 multiselect start selectedselect tag for multiple section dropdown with select2dropdown multiple optionshow to set an element up the select2select2 change optionsmultiple select to select multipkeselect2 multiple selectionmultiselect or multi select checkboxhtml select2how to load select2 in jquerydrop down with multiple selectsearch select2 multiple formselect2 optionmultiselect single selectselect 2 drop downmulti select listadd select2 to inputselect2 multiple selected values dropdowndropdown with multiple selectionmultiple select in dropdownselect2 dropdown can searchhtml dropdown select multiple w3multiple select2 htmlselect 2 dropdown multiselecttext to tags in select 2select 2 multiple dropdwonselect2 initialize codemultiselect with optionselect multiselect differentiate single select and multiple selectselect2 single selectuse multiple select with select 2change select2 optionsselect2 dropdownsselect2 editmulti select chakrselect2 multiple elements initselect2 replace all selectionhow to declare select 2 in htmlselect2 multiple checkboxmultiple select in selectselect2 with ability to write unisted valueselect2 multiple value openselect2 multiselect exampleselect 2 exampleselect 2 two dropdown exampledropdown select multipleselect2 in jqueryhow to multiple select htmlselect2 min js exampleselect 2 multi selectshow image in select2select2 options without idmultiple select dropdown with select in htmlmultiple dropdown in html using selectadd item with image select2select2 multiple select dropdown with checkboxselect 2 get multiselectmulti value select boxes select2select i multi selectselect multiple query selectselect2 multiple select allselect2 initialize multiple instanceselect multiselectselect 2 option dropdown downselect2 multiselectmultiple select2drop down list multiple select htmladd select 2 to inputmulti select with orderselect2 multi select autocompletemultiple dropdown selectionselect dropdown with multiple selectionselect2 with multi selectselect2 multiselect selectedmultiple select2 dropdownselect2 multiple change textwith multiple select queryselect2 demoselect2 usageselect2 for multiple selectionbootstrap select 2 dropdowninput in select select2select dropdown multiple htmlselect 2 dropdown aboveselect multiple from dropdown htmljavascript load multiple select2image in select2select2 multiple select listqueryselector selected multi selectreplace select2 options jquery multiple selectmulti select in select2select2 multiple select dropdown irrirateselect2 option dropdown with imageselect2 multiselect with searchselect2 multi select css examplejavascript select multiple selectorselect from multiple selectsselect 2 multiselect jquerydropdown menu with multiple selectmultiple select htmlselect2 multiple select tagsselect2 multiple selectselect2 multipleselect2 optionsmulti select dropdownmultiselect select 2 input fieldselect2 28 29select option multiplemultiple select select2select 2 dropdown show option downget id mutiple option values select2 jqueryhow to put multiple selectable objects in select command htmlmulti select dropdown select multiple option at a same timeselect2 multi value select boxes exampleselect html multipleselect2 dropdown htmlselect2 multiadd select2 to input fieldmultiple select dropdown select2select2 dropdown in jqueryselect or create selecrt2select2 jquery exampleselect2 custom listmultilevel dropdown select 2select multiple html dropdownmultiple select2 dropdown w3schoolsdropdownparent select2append dropdown option of select 2 in parent elementselect2 exampleson select select 2multiple select in htmlselect2 textboxselect2 tags example ajaxselect multiple in htmloption select multiple dropdownmulti select angularselect2 multiple select dropdownmultiselect dropdown select 2multiple select field with select2jquery select 2 exampleselect 2 dropdown exampleselect class multiselecthow to initialize multiple select2 in jquerymultiple select boxes select2 exampledropdown with img in select2html select multiple dropdownselect 2 multiselect bootstrapselect 2 multipe select 2 multiselect chosen demomulti select dropdown 1 selecteddropdown with multiselectselect 2 multiselect examplemultiple select box htmlhow to use select 2 dropdown2 drop down selectionmultiselect selected valuescan is use select 2 with multipledropdown multipleselect select2 multiple select dynamically add select2 select multiple selecthow to use select2 in jqueryselect 2 js tutorial for beginnersmulti selectselect 2 multiselect checkboxhow to add image in select2 dropdown jqueryhtml dropdown list select multiplemultiple select dropdownselect2 jquery multiplehtml multiselect selectselect2 templateresultintitialize multiple select 2 in one lineselect2 assign dataselect2 dropdown with imageshtml select multiple selectedselect 2 dropdownmultiple selectselect all option in multiselcthow to use multiple components in selectselect2 dropdown option select 2 costum exampleselect 2 exampleshtml select multiplemultiple select boxchange in select2use image in select2 optionsimple select2html select2 jquerydrop down two multi selectselect2 28 29 jqueryselect 2 display dropdown in tablemultiple select 2 to select multiplehow to use select 2select2 textareamultiple dropdown selectselect multiple selectssimple select2 for html selectmultiple select dropdownselect2 dropdown selected cssmulti select select boxselect2 auto select in edit pageselect2 class for optionselect 2 jquery examplesimple multiple select dropdownselect2 use in multiple fieldsjavascript select2 multi selectselect 2 multiselect simple formsimple dropdown select2use select 2 with multiple selectselect option data image flag 2fimageselect2 multiple selectedselect html multi selecthow to use multiple select is possible to do multiple selectselect2 multiselect to single selectsingle select multiselectselect dropdown search jqueryselect 2 multiselect with checkboxselect2 dropdown to topmultiselect htmlselect2 add image to optionmultiple select multi option in htmlmultilevel select with select 2select2 select multiple itemsselect2 multiselect widget sampleselect multiple dropdown htmlget html multiple selectmulti select2 jquerymultiselect drop down select boxmultiple select divselect 2 multiplehow to select 2 options from a drop down listselect2 multiple dropdownselect2 multi select dropdown example 40html multiple selectselectbox multiple select htmlselect multiple in select2how to select multiple dropdownmuktiple select 2 select 2 multiselect to singlecombobox multiple selectionjquery dropdownmulti select comboreplace select2 values select 2 multiselect get data multiple select using dropdownselect2 select singleselect 2 dropdown krajeeselect 2 dropdown select all optionselect2 dropdown phphtml select box multipledropdown with search jquerymultiple select dropdown boxinput multiple select2select 2 multiselect deselect option eventmultiselect comboboxselect2 multiple select ajax exampleselect2 multiple select jsselect 2 multiselect select all buttonmultiselect dropdown htmldrop down multiple selectmultiselect dropdown in tablemultiselect html selectselect2 javascript examplesselect2 select multiple select 2 selected value multihow to add image in select2select2 replace dataselect multi selectionselect2 multiple select values dropdownmultiple select in select 2image on select2select of the multi selectdropdown menu in select2 with two valuesinit grouped select2select2 multiple selected viewhow to select multiplte classes in a single quereyselectorhtml multiple select select multiple option in dropdown htmlmultiple select dropdown in htmlselect 2 dropdown codepenreplace two select2 change valueselect2 multiple optionsselect2 htmlselect 2 dropdown