Newest 'jquery-select2' Questions

Q&A for professional and enthusiast programmers

Handling dropdown items that get cut off

I am using select 2 dropdown jquery which is similar to this one here: http://www.jqueryrain.com/?IV38o2Lr Now the only thing is the dropdown is on a filter bar and is fixed width and height when ...

How to add new options at last of select2 box?

I am trying to add select2 options at last of select box every time, When I am choosing a new option from select2 options Its adding sometimes 1st position, sometimes last or middle of others options. ...

How to make single selection in select2 looks like multiple?

Single section and multiple selection modes in select2 look different. In single some window below opens with text but in multiple it looks like a search bar in google without any text. How to make ...

How to deal with checkbox inputs actions inside Select2 element

I'm using the composant SELECT2 ; i have customized it to transform its options to checkbox inputs; Besides i'm using the event : on('select2-selecting'){} to do some treatment , and i wanna add the ...

jQuery Clone and select2

I have created select2 dynamically from hidden input at first time on the page then I am cloning it with a tag. But when I clone the div select2 won't appear. Kindly somebody help me what I am doing ...

How to not add the a checkbox to the “optgroup” of a select2 wen injecting the checkbox input

i'm using Select2 with checkboxes injecting like the following : <select id="select" style="width: 300px;" multiple="multiple"> <optgroup label="Inclure Group"> <...

Formatting JSON response in Laravel 5 for Select2.js

I am populating a city list (after selecting a county from a dropdown), using an Ajax call with Laravel 5.2 and Select2.js. I want to format the JSON response from the ajax call so it matches the ...

select2 initSelection for redisplayed the form

I'm Using Select2-rails '3.5.3, I can do search with remote data and save it, the problem is how I can restore the selected text (for example if user press edit), problem: initSelection is not fired ...

How to clear select2 dropdown?

I am working on a requirement that I have to clear a select2 dropdown box after form submission through ajax. I have searched & tried few solutions but didn't work though. my select2 code is: $(...

Select2 - Search within the whole content not just start with [duplicate]

I'm using select2 and I want to allow the user to search the entire word not just the beginning. For example let's say I have the following list: first place moto secondo place moto third place moto ...

Keep focus after selection is made Select2

I'm having an issue with Select2 keeping focus after a selection is made. I have some long forms in my application that need to be tabbed through. Right now, once a selection is made with Select2, ...

Laravel 5.2 with Select2 v 3.5.1 ajax method POST, token mismatch

I am trying to use Select2 using type: POST and try to pass the token through headers just like ajax request. But I got TokenMismatchException. But I've already tried use Select2 using GET and it ...

Need to make toggle option

I am using select2 plugin for custom combobox and auto complete. Now i need to make toggle like if all select disable to select other option or if i select other option need to hide/clear all option. ...

Error styling with Select2 and Parsley

I am stuck with following (simple) modification to combine Select2 with Parsly validation. I want to change the bordercolor of a select2 selectbox. Just add a class or style to the span.select2-...

Rails 5, Simple Form with Select2-rails

I'm trying to figure out how to use select2 with simple form in my rails 5 app. I am using acts as taggable on in the app. I have installed this gem in my gem file: gem 'select2-rails' I tried to ...

nested less styles not apply for angular select2

I was tried to apply custom less for select2 working fine, but when I try with nested less styles not applying those styles Since the select2 dropdown will create out of the particular div. I have ...

How to add unique ID to select2 dropdown

I am having an issue where I have multiple select's on the page and we are using select2. I would like to style just this one specific select but i'm having trouble making it unique so I can add some ...

Select2 get html data attribute

I'm using latest select2 version. But stuck at getting <select> html attribute. <select name="category" id="category-select" data-ajax--search="slug" class="select2 form-control m-b-2" ...

How to remove the extra options in the select2?

There is a select2 element in my JSP page : <select class="form-control select2" id="menu_code" style="width: 100%;"> <option value="">${select_action}</option> <c:...

Reading option attribute

I have a select (converted into a select2) defined like this: <select class="form-control" name="Questions[3].ANSWER_LOOKUP_OPTION_ID" id="Questions[3].ANSWER_LOOKUP_OPTION_ID" multiple=""> ...

CSS : Select2 area of results (selected) is behind area of choices (options) while selecting

I'm using Select2. I have a simple issue : when i'm selecting elements , and the numbers of those selected items grows up -> "the Area of results" seems to appear behind the "area of choices" . As ...

Select2 multi select not working

Hi i used select2 (https://select2.github.io/) in my site and it's not working there. on click classes etc changed like example one but it didn't shows the select box options and there is no error in ...

Make jquery 1.9.1 to work using compatiblity view in IE

I have developed a site that uses Bootstrap 3.3.5, Select2 4.0.3, jqGrid 5.1.1 and jquery 1.9.1. In IE (without compatibility view), select2 and jqgrid controls looks good and the ajax call works to ...

Jquery Select2 4 - Ajax “no results found” when using custom data

I can't get the Ajax example to work outside of the github example on the documentation page. Here's what I'm trying: https://jsfiddle.net/vhrpzcuv/8/ <select name="test" class="select2picker" ...

select2 set preloaded tags from html option

I have the following html, the <option> tags are generated by me (by php, more precisely symfony3) <select name="simple_event[tagsList][]" id="js-tags-list" class="form-control" ...

Select2 Ajax won't show the results

I'm having issues witht the select2 $('#charity_user_id').select2({ ajax: { url: "/get-users", dataType: 'get', delay: 250, data: function (params) { return { ...

Javascript - Load JSON to Select2

I want to use select2 plugin for my project. I followed this example, but it doesn't work for me. JSON OUTPUT: {"status":1,"id":"12","title":"Program 3","content":"This program is for MBA Students"} ...

Select2-Not converting my select

I am trying to use the Select2 JQuery control and can't get it to work with a select on my form. This select is defined like this: <select class="form-control" name="QuestionBasicSection....

Select2 remote data: select value Null

I render my dropdownlist in mvc razor like this: @Html.DropDownListFor(m => m.SelectedContact, new SelectList(Model.ContactList, "ContactId", "Name", Model.SelectedContact), "(Geen)", new { @class ...

Opened jquery select2 dropdown breaks tabindex

Due to a legacy front-end I got this hacky listener for opening my select2 (v4.0) dropdown upon focussing the select element. It works just fine, except for the fact that my tabindex is somehow set ...

How to name select id element using jquery each looping?

I want to implement jquery select2 plugin into a form. I have a problem with naming the textbox so that the select2 can be triggered. Here is the html: <select id="select1"></select> <...

jQuery Select2 TypeError: b is undefined

I am using jQuery (1.12.4) and Select2 (4.0.3) to select multiple values from DB but I'm getting following error. TypeError: b is undefined JS Code $('#country').select2( { ...

What's wrong with select2 4.x optgroup?

"optgroup" works well in 3.x versions, but in versions starts all of 4.x I have only "No results found" in dropdown. What's wrong? Official haven't issue about this bug. My jade: select.select-js(...

Select2 autocomplete by option value

I have tried to integrate tag/autocomplete for my site. Its working through option text. I am almost close to result but still hanging. Now when you try to select option text there will appear ...

Yii2 Select2 Widgets and Composite Keys

I have a table that have three Composite keys. Now I need to present a form to the user for a choice. Each choice in the list should submit all three values. I'm thinking of concatenating the PK and ...

how do i install JQuery select2?

i have been trying to install and use select2 for my drop-down but i just cant get it to work, i tried following what is documented here: how to use select2 bootstrap but still got no luck here is ...

Select2 Multiple options placement [duplicate]

I'm using a Select2 Multiple select box in my asp.net page with token enabled. It's working great but right now, no matter the order at which I select the options, they always rearrange so that it's ...

Converting EXTJS Combox to Select2 / Display Select2 drop-down in EXTJS Panel

I have a Panel in which I'm dynamically displaying an EXTJS Ext.form.ComboBox inside Ajax success method. var parentIssueList = Ext.create('Ext.form.ComboBox', { store: parentIssueStore, ...

Select2 - filtering special characters

I have a problem with select2 plugin. When I use filter and type "mąka", it finds all the options with "mąka" and "maka" word. Is it possible to customize this script to find just the "mąka" word? ...

Select 2 issue while showing records

I am implementing select 2 in remote mode, data is coming , but not displaying in dropdown, can anyone point out the mistake i am doing? when records came from DB, the dropdown hidea and don't show ...

Customize Select2 behaviour whith chechboxes inputs options

I'm using select2 . I want to use checkbox inputs instead of simple options. i Want when i check an element , it appears in the select without disappearing from the list of checkbox inputs , and ...

SELECT2: Uncaught TypeError: Illegal constructor

I'm using select2 for one of my input at the init of the page, when you first click on one of the select2 option you get this error. Then it works normally can anyone help me ? Here's my code I'm ...

Need to create select2 drop-down when click on text box

i have a requirement that when i click on input type text box then select2 drop-down will automatically upon textbox and another text box will be automatically created down the select2 drop-down.

jQuery Clone and select2 events

I have created two hidden fields where I am adding array to make dropdown. select2 array are depending on the first select2. So when I select in first select2 I will call select2 event to filter ...

Select2 pre populated data value shows null on form submit

I've tried initSelection in select2 to load some pre selected data in my multiple select box. User can select multiple options while creating an item and when s/he tries to edit that item again s/he ...

How to make AJAX working with select2?

I'm quite new in AJAX and I'm trying to get results from AJAX request in select2. This is my HTML: <select class="js-example-basic-single" name="Airport"><option disabled selected>...

Select2: How to add option dynamically when list is empty

I'm using select2 and have noticed that if there are not an option provided in the HTML (ignoring the blank one shown below to allow the placeholder to work), it won't let me dynamically add my own ...

Is it possible to display alternative text for selected items in a Select2 MultiSelect?

I am using a Select2 MultiSelect with a set of grouped options: Group 1: Option 1 Option 2 Group 2: Option 1 Option 2 etc. When an option is selected (and thus shown in the input field) it would ...

Adding image next to text in select2 sends an object

I'm trying to add image next to text using select2, here is my code : $(".js-example-templating").select2({ templateResult: formatState, templateSelection: formatState }); function formatState (...

Sending multiple select values as array with select2.js

I am using a multiple select field with select2.js and am trying to send multiple values in the same array. The problem is is that when I serialize the form, the values are not joined into an array of ...
Translating... 0%