Questions tagged [jquery-select2-4]

Select2 4.0 was released in April 2015 and is a complete rewrite of the Select2 code base. Please only use this tag if your issue is specific to this version.

Filter by
Sorted by
Tagged with
0 votes
0 answers
30 views

Select2 doesn’t scroll down automatically on selected option on opening

When I select the option named "Item 6" (at the middle of the list) and re-open select2 element, it doesn't scroll down automatically on the selected option on opening but stays at the top. ...
finnegerd's user avatar
0 votes
0 answers
17 views

Select2 V4 - Lock some selected values

I'm trying to prevent some selected values from being removable when making multiple selections with Select2, they should not have an X symbol on them. There is a locked feature in the old version of ...
Hakan Özdemir's user avatar
0 votes
0 answers
15 views

Select2 4.x Preload AJAX option with extra data fields

I'm migrating from Select2 3.5.x. I have a lot of instances where I just the ajax option to get data that is more than just {id, text}. In 4.x, I am getting the ajax calls working well. However I ...
Josh Bilderback's user avatar
0 votes
1 answer
34 views

Preselecting option in an remotely sourced (AJAX) Select2

I am trying to preselect an option in select2 from a remotely sourced select2 control. I am trying to follow the documentation Preselecting options in an remotely-sourced (AJAX) Select2 I have an ...
user351479's user avatar
1 vote
1 answer
43 views

Display select2 ajax results into template

I have select2 displaying data after making an ajax call. <script> $(document).ready(function () { $("#citySelect").select2({ theme: 'bootstrap-5', ...
user351479's user avatar
0 votes
0 answers
32 views

In the latest Firefox version, a document click event triggers on select mousedown, unlike other browsers

Description: In the latest version of Firefox, I'm encountering an unexpected behavior related to mousedown and click events when interacting with a select element within the Select2 library. The ...
keerthivasan g's user avatar
0 votes
0 answers
9 views

Select2 start searching after first N characters using ajax

I don't want to call ajax request if user input only one character in search field. Request should be called only if user doesn't input characters or input 3 and more characters. Does select2 have ...
Stefan Hansch's user avatar
1 vote
2 answers
230 views

select2 multi group select. Select parent, disable child nodes. Unselect parent, enable child nodes

I have implemented 2 custom functions with select2: Select parent node, add parent node to selected and disable child nodes. Unselect parent node, remove from selected and enable child nodes. This ...
ivantxo's user avatar
  • 629
0 votes
1 answer
72 views

Clear Select2 Search Input When No Results Found

I am using jQuery Select2 version 4.0.13. I would like to auto clear the search text box when the No Results Found displays. Sort of a reset of the dropdown options. Currently I use scanned barcodes ...
Steve Dyke's user avatar
0 votes
2 answers
913 views

livewire 3 and laravel using select 2 window.livewire.on('data-change-event',()=>{ expression statement is not assignment or call

I am trying to use select2 with livewire 3 in laravel 10. But when I am trying to write a script in resources/views/layouts/app.blade.php, it is showing the below error , "()=> expression ...
Moon's user avatar
  • 3
0 votes
0 answers
41 views

Retain select2 multiple selected dropdown values after form is submitted in the select field

I am using Select2 and populating dropdown options for 3 form fields from my database. As part of my form submission process, I've broken it down into two steps: User inputs 3 select2 multiselect ...
gakshat's user avatar
0 votes
2 answers
53 views

JavaScript new Table row Class not applying

In my web application, There is a table and Add button. Whenever the user clicks on the Add button, from javascript, I load the new row to the table. In the row, there is a element and for that class,...
Dev Beginner 's user avatar
0 votes
0 answers
99 views

Select2 Bottom of placeholder text is getting cut off

The bottom of the placeholder text on this Select2 multiple select is getting cut-off, how can I edit the CSS classes of this input to stop this from happening. Here is my current code: <style> ...
cobysh's user avatar
  • 55
0 votes
0 answers
67 views

How to modify Select2 AllowClear functions?

I have created a custom adapter for Select2 Selection where I want to show input field directly in the select instead of dropdown. $.fn.select2.amd.define('SearchableSingleSelection', [ 'select2/...
vabs's user avatar
  • 98
0 votes
0 answers
15 views

Add new option with custom data attributes to serverside processing select2

I'm having a problem with adding new option with custom data attributes in serverside processing select2. here's my select2 html : <select name="resellerid" id="resellerid" ...
Yusuf Giovanno's user avatar
0 votes
0 answers
57 views

Select2 with ajax in lravel 10 don´t work

I am working with select2 v.4.1 and laravel 10every time I try to make the query I do not get any information, it is not activating the ajax query either in the error console only an error appears ...
Ivan S's user avatar
  • 1
0 votes
0 answers
75 views

How to change select2 input language to Persian as you type in without ALT+SHIFT

I am working on a website where users have to fill fields in different languages. I don't want users to change their writing language using Alt+Shift keys, but I want the input language to change to ...
saman shirmohammadi's user avatar
0 votes
1 answer
145 views

Clone select2 element in current version (4.0.13)

The essence of what I’m trying to do is already asked & answered here in this SO question. That question includes a fiddle and code that works in an prior release of select2 (v3.3.2), but does not ...
B4THC4T's user avatar
  • 49
0 votes
0 answers
117 views

Select2 change quietMillis/delay dynamically

I have an issue with pretty simple conditioning in select2: if there is no search query, make get request immediately, else if there is search query - wait 2000 millis since last keydown and make get ...
Nkwitchoua's user avatar
1 vote
0 answers
117 views

How to preselect options when using select2 multiple select box with an ajax data source

I have a table in a form in a flask app with a select2 multiple select dropdown in each row of the table. In the table in the template file I have: <select name="visible_bonuses[{{ country.id }...
Tom Pain's user avatar
0 votes
0 answers
89 views

How to change the configuration of select2 dynamically?

I am trying to change the configuration of a select2 field dynamically based on whether a checkbox is checked or not. I am already using a function to get the remote URL, based on the status of the ...
mohammed aqeel's user avatar
0 votes
0 answers
225 views

Select2 dropdown position above or below not working

I am using select2 4.0.6-rc.0 version. I have added search option in a select2 field inside modal (.modal-body) whenever someone selects something from that input box it adds a row in a table. The ...
Hello World's user avatar
  • 2,733
0 votes
0 answers
32 views

How force Select2 to call ajax immediately to load another select2 when selection is made

I'm trying to load a select2 (opt2) based on the selection on another select2 (opt1), with ajax. This is my code, I was expecting the ajax to be called immediately when I select the option from opt1. ...
Sergio's user avatar
  • 1
0 votes
1 answer
74 views

Select2 selecting same index with external data source doesn't trigger change event

Using select2 version 4.0.10. My datasource is returning the data I expect. The select2 is a single select. Re-selecting the data wouldn't be harmful. I presume this is a problem with the external ...
Roe's user avatar
  • 727
1 vote
1 answer
541 views

How to include a label in jQuery Select2?

I've set up a Select2 instance that queries my database and renders the results via AJAX on an input that the user has access to. Everything is working but as this is a location selection input for a ...
António Lima's user avatar
0 votes
0 answers
90 views

Thymeleaf Select2 multiple preselected values doesn't work

I am using Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md with Thymeleaf. <div class="form-group"> <label class="col-sm-2 control-...
Sinan's user avatar
  • 11
0 votes
0 answers
76 views

Select2 v.4xx Pagination for Infinite Scrolling Codeigniter 4

I tried the pagination feature for searching data using Select2 4.x, but I haven't been able to achieve it. Does anyone know how to do it on codeigniter 4 by including the CSRF token. If the user ...
Anwar Hoja's user avatar
0 votes
0 answers
47 views

How can I implement a dropdown with 100 default options and the ability to search and retrieve additional options from database using AJAX in Select2?

I have 100 options on a select/dropdown and more in the database. Users will select option if available in the dropdown. If not, then the user will search and an ajax will call to get others from ...
Hafizur Rahman's user avatar
0 votes
0 answers
70 views

How to make Multiple dependent dropdown in CRUD Django?

Fields are such as; Phone Name(Field1) Samsung Redmi Phone Model(Field2) M30 Note10 Note : Dependency between Phone Name and Phone Model(if select samsung from the dropdown then M30 should comes and ...
magib977's user avatar
0 votes
0 answers
57 views

Select2 doesn't select option

I use select2 with AJAX data source. It shows the options, but when I choose one, it doesn't show/select the label. It keeps showing empty or the placeholder. HTML <input name="organization&...
Dev Guy's user avatar
  • 35
0 votes
1 answer
371 views

Select 2 focus on search on click/tab without unique ID

I am using Select 2 4.0.13 on jQuery 3.6.1 and am looking for a way to allow the search bar to be selected when the Select 2 is opened. I found https://stackoverflow.com/a/67691578/1278201 which does ...
bhttoan's user avatar
  • 2,661
0 votes
0 answers
290 views

Select2 not displaying the select box

I have a problem with the Select2 plugin's last version, I don't know why the select box isn't showing up. I'm using Bootstrap 5.1.3, JQuery 3.6.1, Select2 4.1.0rc JavaScript: const locationSelect = $(...
Developer lci-agency's user avatar
0 votes
0 answers
184 views

select2 textarea field cant able to give input

I would like to give search field in dropdown with multiselect so i went with select2 library but i could not able to give values for the input field. dynamicTable = $("#" + gridId)....
Srinidhi S's user avatar
0 votes
0 answers
24 views

Order of selected element in jquery-select2 4.x

I would like to use the 4.x version of jquery-select2. I do not understand this behavior : having a multiple select, when I select elements in a specific order, they always are added in the same order ...
Simon Terrien's user avatar
0 votes
0 answers
73 views

Select2 how can I trigger ajax query on multiselect after selecting an option?

I have a multiselect field with ajax data source. What I'm trying to achieve is to narrow down results after selecting one of the options so I would need to trigger ajax query after selecting an ...
Bananica's user avatar
0 votes
1 answer
230 views

Cant change title for tooltip in select2 selected options

$(document).ready(function() { $('.reminder-numbers-select').select2({ tags: true, dir: "rtl", dropdownAutoWidth: true, width: '100%', }) }); #rem-no { width: 100%; } <link ...
Meet Gondaliya's user avatar
0 votes
1 answer
134 views

How to set value programmatically to Select2 jQuery & ASP .Net Core

I'm working on a ASP .Net Core project where for the first time I'm using Select2. I have one page where I'm passing the ID's that I need by ViewModel like this: Controller: public async Task<...
makaMa's user avatar
  • 11
1 vote
0 answers
266 views

How to display selected multiple dropdown values in select2 jquery laravel8

i have 3 tables dealer_master,distributor_master,dsdl_master. In dsdl_master table dealer specific distributor has been saved. I have getting all the distributor list. using dsdl_master table i'm ...
Praff's user avatar
  • 41
0 votes
1 answer
144 views

How To Get Data From Api And Display It To Related Control In Dynamic Table When User Select An Item From Select2 In Laravel?

How To Get Data From Api And Display It To Related Control In Dynamic Table When User Select An Item From Select2 In Laravel? I am using Laravel with select2. In my form I am adding select2 and input-...
Chandan A.'s user avatar
0 votes
1 answer
280 views

Dynamic Select2 Item Automatically Cleared When New Select2 Is Added In Form?

I am using Laravel with select2. In my form i am adding select2 dynamically and getting select2 data from server using ajax request and its working fine. But Problem is... When I select an item from ...
Chandan A.'s user avatar
0 votes
1 answer
604 views

select2 - "trigger" does not fire

When I open the drop-down the value I set via jQuery is highlighted but doesn't get triggered/selected. Clicking on the highlighted option also doesn't do anything until I click the other option and ...
D Shah's user avatar
  • 1
1 vote
1 answer
211 views

Select2 dropdown is not adding classes to its dropdown items from original options

Select2 is not adding the classes to its dropdown items from the options Suppose in the below dropdown code, attribute class="highlight" was added to few options to highlight those with some ...
Kumar Jalli's user avatar
0 votes
1 answer
24 views

How to modify select2 serach box text on keyup?

I'm trying to change the text of select2 search box on keyup event. Suppose whenever we will write a Bangla digit it will automatically convert into an English digit <div class="form-group col-...
Julan Mohajan's user avatar
1 vote
1 answer
1k views

select2 not displaying selected value text added programatically

I have a dropdown created with select2 (v4.0.13 and I can not change it) using AJAX requests on a form where the user can search for things. The page is built with Thymeleaf and when the view is ...
MinionAttack's user avatar
0 votes
1 answer
579 views

How can I select children options from optgroup in Select2?

Question: I have successfully created a select2 template with a group but I can't select the items in it, is there anything missing from the code I made below? Any help from you means a lot to me, ...
A human being's user avatar
1 vote
2 answers
333 views

modal form validation after using select2

I am using partialview in modal form. In this form there is a select2 option list which working fine. But when press submit button, required fields as per model are not validating i.e. not showing ...
Anil Kumar Bhakta's user avatar
0 votes
1 answer
142 views

Search a word in select2

I have an ajax result as follow: { "data": [ { "id": "AABB", "text": "AABB" }, { "id": "BBCC", ...
FBDon's user avatar
  • 23
1 vote
1 answer
4k views

Select2 li - aria-selected=true is not read as selected by screen reader

I am currently using select2.js version 4.0 and having this issue where screen reader (NVDA) won't read the selected option, even aria-selected="true" is added correctly to the current ...
Yhajiks's user avatar
  • 115
1 vote
1 answer
2k views

Select2 - multiple inputs with select 2 shares the same options when one of them is selected - BUGG

I am facing a strange problem with the Select2 library. I have added a few select html elements with different options specified for each tag. Each select is decorated with: <select id="...
Hawos's user avatar
  • 33
1 vote
1 answer
981 views

How to prevent select2 to call select2:close the second time when selectOnClose is set to true?

I am using Select2 V. 4.0.10 I want to have a select2 that behaves the same way when you select using the Enter key and the Tab key. What happens is that when selecting using the Tab key, the close ...
egillanton's user avatar

1
2 3 4 5
11