select2 example – Jquery Select2 – Select box with search example code

select2 example – Jquery Select2 – Select box with search example code Explain Chosen and Select2 with examples. Select2 is a jQuery-based replacement for select boxes.

select2 example – Dynamic option creation

It supports searching, remote data sets, and pagination of results. Select2 plugin is used to customize HTML select element.

select 2 dropdown

  maximumSelectionLength: 2

Select2 dropdown example


    Jquery Select2 - Select Box with Search Option -  

Select Box with Search Option Jquery Select2.js - Example

add image in select2 dropdown

    templateResult: formatcategory,
    templateSelection: formatcategory

function formatcategory (fldt) {
    if (! {
        return fldt.text.toUpperCase();

    var fldtimage = $(fldt.element).attr('data-image'); 
       return fldt.text.toUpperCase();
    } else {                    
        var $fldt = $(
           'select2 example,select2 example ajax,select2 example angular,select2,select2 js ' + fldt.text.toUpperCase() + ''
        return $fldt;

select2 replace options

var showDataDropDown = function () {
    var details = [];
    var selectedplayer = $("#players").val();
    $.each(pageData.products[selectedplayer].qty, function (key, value) {
            text: value,
            id: key
        data: details


Don’t Miss : Jquery Select2 Ajax Autocomplete Example With Demo In PHP Codeigniter Example

I hope you get an idea about select2 example.
I would like to have feedback on my
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment