5,570 questions
0
votes
2
answers
96
views
Issue with select2 and option group
I am adding a new option to a select2 optiongroup with custom drawing of options. here is my code:
function defaultParameter(value, defaultValue) {
return typeof value !== 'undefined' ? value : ...
2
votes
2
answers
93
views
Scroll an option into view on open
I have a select with months.
The most used is April, so I'd like to present it when the user open the select when nothing else is chosen already.
I have a solution that works well in Chrome (the ...
0
votes
1
answer
43
views
Certain django-select2 fields won't render when multiple forms are used on single template
I have an issue rendering some select2 fields:
When multiple forms with same select2 widget are used within a single template some select2 fields are not rendered as expected (rendered just as normal ...
2
votes
1
answer
54
views
select2 Laravel - Always Showing JSON
I can't get the results to return to the select box, it's always showing JSON instead.
public function autocomplete(Request $request)
{
$data = Pegawai::where('nama', 'LIKE', '%'.request('q').'%')-...
0
votes
1
answer
54
views
Using Select2 in a popout window in ASP.NET Core MVC
I've been attempting to use Select2 in my ASP.NET Core MVC project. I have a partial view that has a pop out window for creating participating agency records.
What I'm trying to do is use the select2 ...
1
vote
2
answers
146
views
Django Select2 Autocomplete: How to Pass Extra Parameter (argId) to the View?
I'm using Django with django-autocomplete-light and Select2 to create an autocomplete field. The Select2 field is dynamically added to the page when another field is selected. It fetches data from a ...
1
vote
1
answer
181
views
How to control select2 selection on change event?
I have a multiple select element with select2 v 3.5.2 plugin.
I need to be sure that the specific option value -1 will be not selected with other values.
I tried this solution:
$('#mysel').on("...
0
votes
1
answer
220
views
Select2 inside Livewire Modal Not Reinitializing on Modal Reopen
I'm using Livewire in a Laravel project and have a Select2 dropdown inside a modal. The dropdown is used to select a country, and it should initialize with a list of countries while also pre-selecting ...
0
votes
2
answers
88
views
Prop hidden() or hide() and show() can't used in Select2 Multiple Option
I want to ask about select2. I want, when I choose the option it will be hidden from the options in the select. And also if we remove it in multiple select option, it will be showed too in the option. ...
0
votes
0
answers
45
views
Search not working for select2 with custom data on a modal
I'm using Select2 4.0.5 with bracket plus bootstrap 4. Its working fine so far with my customData. I tried creating a test select element outside the modal with my current setup for initialization and ...
-1
votes
1
answer
58
views
Select2 dropdown shows & hides instantly when Wordpress admin bar is visible
With logged in user and visible admin bar in Wordpress, when trying to select an option through select2, the container shows and hides instantly. The user is not able to click any option from the ...
0
votes
1
answer
48
views
Select2 data ignored when init control
My HTML code is:
<select id="block-permissions" name="permissions" multiple="multiple">
{{-- <option value="0">Topic 0</option> When ...
1
vote
1
answer
38
views
How to make trigger change work in Select2?
There is a piece of code that is responsible for updating the QR code during events ['paste', 'keyup', 'change'], but for some reason the Select2 list does not work and accordingly, does not transmit ...
0
votes
1
answer
323
views
Blazor + select2 + @bind
When I use select 2 I can't get the value, it always returns null.
Can you help me? I've already tried doing @bind, @onchange and nothing works.
My Code :
<select class="form-select" data-...
1
vote
0
answers
97
views
Select2 js with checkbox options
I want to have checkbox to select in my options but don't know what to do.
References
Here is my select box code:
<select class="form-control select2" id="data-set" name="...
1
vote
1
answer
119
views
The clear button overlaps the placeholder
My clear button overlaps the placeholder:
Have you ever had this problem?
I'm using the bootstrap5 theme for select2.
Everything else works.
It's just this button that's causing the problem.
Thanks.
...
0
votes
1
answer
228
views
Select2 is shown twice when opening modal the first time
I have the modal where this modal show the content dynamically by using js. the modal html is like this:
<button type="button" class="openModalBtn btn btn-outline btn-primary btn-sm ...
0
votes
1
answer
39
views
How to add actual option value into list item?
Using the select2 javascript for select boxes, it basically hides the actual real select box and gives you a span with a ul li list inside.
However, the li options don't have the actual real value ...
0
votes
1
answer
147
views
Sorting selected items in ng-select2-component
I have a project in Angular 15 that uses the ng-select2-component npm library for the dropdown component (both single and multi). The selected dropdown values themselves are attached to a form group ...
0
votes
1
answer
72
views
CSS Set border-radius of select2 in input group
I want to set the border radius of this select2 in this input group to 0
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-user&...
0
votes
0
answers
66
views
How to Trigger an Event When Select2 Dropdown Value is Null in Vue.js
I'm working with a Vue.js application that uses the Select2 library for a dropdown in my reviseReport component. I have a NestedForm component where this dropdown is implemented. I need to trigger an ...
0
votes
0
answers
53
views
How to use HTML5 instead of form helpers -- Using Select2 JS with "acts-as-taggable-on" gem
I am using the acts-as-taggable-on gem as well as the select2.js library.
My community_resource.rb looks like the following:
class CommunityResource < ApplicationRecord
acts_as_taggable_on :...
1
vote
0
answers
86
views
Select2: "Cannot read properties of undefined" when prepending/unshifting data on scroll up
I'm using Select2 and trying to implement a feature where new data is prepended or unshifted to the dropdown options when the user scrolls up. However, I'm encountering the errors "Cannot read ...
-1
votes
1
answer
195
views
How can i get value from select2 using only javascript without jquery
I'm trying to get the value of a select2 by the change event, but I only found ways using jquery and I want only with javascript.
selectProduct.addEventListener('change', () => {
console.log(...
0
votes
1
answer
298
views
Select2 + bootstrap modal issue
Bootstrap version: 5.1.3
Select2 version: 4.1.0
Link to replicate: https://jsfiddle.net/L60xwgmt/1/
$('.select2').select2({
dropdownParent: $('#dataModal'),
...
0
votes
2
answers
109
views
How do i allow clear items only on specific items on Select 2 multi select
Lets say I have item1,item2,item3 pre selected, how do i allow the user to delete only item3 and hide the X delete button from the others.
Thanks in advance
0
votes
1
answer
179
views
Problem django-autocomplete-light! new version chrome
I have a django application with python 3.7 and Django 2.2.10, which uses django admin, with the materialize css subscript for the templates. From the latest Chrome updates, the behavior of forms in ...
0
votes
1
answer
104
views
Form Repeater destroy Select2 dropdown UI
I'm trying to reinitialize Select2 for dynamically added repeater items in my form. The Select2 plugin works fine on page load, but when I add a new repeater item, the Select2 dropdown UI isn't ...
0
votes
0
answers
74
views
jQuery select2 inside a responsive table
I am using select2 inside a responsive table and it's adding unnecessary horizontal scrollbar to the page. If the select element is visible on page load, then the scroll bar doesn’t appear. However, ...
1
vote
1
answer
2k
views
Multiple select using select2 in Livewire 3
I want to create multiple selects using the select2 plugin in the livewire component, but the first time I do select "onchange", my select2 disappears into a regular select option. I've used ...
0
votes
1
answer
93
views
Format of Select2 Option HTML drop down
I am seeing something I can't explain. I am using Select2 for a searchable drop down field. I am trying to configure the options with a different string for the value as opposed to the text. I ...
1
vote
1
answer
122
views
Select2 throws too many events when clearing the selection
I am using Select2 for a multi select. This select is used to filter a list.
Selecting one item rebuilds the list with that filter(s). Removing one item, again rebuild the list without that specific ...
0
votes
0
answers
74
views
How do I refresh the result list without closing the select2?
when the result is not found, the text "result not found" appears and the existing data is hidden.when I delete it with backspace, the old data comes back before the combobox closes.when I ...
0
votes
1
answer
57
views
How to create a dynamic chain select with strings using Select2
I am creating a DnD style calculator. There are class trees that are 3 classes deep. How would I be able to force Select 2 to only show level 1, level 2 and level 3 in their respective selects and ...
0
votes
0
answers
75
views
Select2 ajax based results filtering based on regex on client and server side
I have implemented select2 in codeigniter for ajax based results and its working perfectly. But the challenge I am encountering is that the data in database is not sanitized e.g
E.C.G Machine
ECG ...
0
votes
1
answer
59
views
Dynamically-created Select2 options won't save to database (Wordpress + BuddyPress)
I’m using BP XProfile Custom Field Types plugin to add a “Tags” field (select2-based multiselect) to the BuddyPress user profile page.
After the edit profile page loads, I’m dynamically adding new ...
0
votes
0
answers
68
views
Select2 multiple when I press button remove select item my modal is closed ,but my modal shouldn't close
This is my code tgoMeanItem id is multiple select2
<div class="col-lg-12 mt-2">
<label for="date-field" class="form-label">
<strong class="...
0
votes
1
answer
73
views
JQuery Select2 dropdown not able to set the text in MVC
I am using the select2 jquery plugin. I was unable to set/assign the text to the select control. I used select2 with trigger function for setting the value. Firstly the control which I have taken is ...
0
votes
0
answers
96
views
Disable auto focus on select2 drop-down in modal?
I have added multiple Select2 dropdowns in my modal and initialized these select dropdowns when the modal opens. There was one problem: when we open the Select2 dropdown, its positioning was not ...
0
votes
0
answers
63
views
Wordpress Select2 Ajax query call data from DB
I'm a beginner coding with JQuery Select2 and Ajax.
I'm trying to load dataset from DB into JQuery Select2 dropdown with search option.
This is the function for DB query and enqueue scripts in my ...
0
votes
1
answer
50
views
Cannot make preselect value in select2 dropdown
I have select 2 dropdown in my project
Here is how it's added on view (Razor)
<div class="form-group">
<label class="required-label">Tier</label>
...
1
vote
1
answer
111
views
How to pass the selected value of select2 element as parameter in htmx?
I want to do GET request with query parameter. However, the query parameter need to be taken from select2 elements. How do I pass the selected value of select2 to htmx?
Below is the simplified ...
0
votes
1
answer
100
views
The footer is adding multiple times below different select2 dropdown
I am using select 2 jquery plugin to create multiple multi select dropdowns, At some scenarios the footer is getting appended multiple times under the dropdown menu. For example if you open drodpown 1 ...
0
votes
1
answer
65
views
select2 date custom option is not opening if clicked again
$(document).ready(function() {
///dateee picker
$("#date-range-options").select2({
placeholder: "Select",
minimumResultsForSearch: -1,
closeOnSelect: false,
allowClear: false
})...
-1
votes
2
answers
264
views
Select2 not working on localhost (html-PHP)
I am trying to use select2, but for some reason it does not work. The code below is fairly simple: it pulls data from a Microsoft SQL database, and creates a dropdown list.
All of this is running on a ...
0
votes
1
answer
221
views
select2 troubles with positioning in lightbox modal [closed]
Using Select2 4.1, jQuery 3.7
When I show the select2 in a modal/lightbox, it does not position the dropdown correctly. When the select is clicked, it should show the dropdown directly above or below ...
0
votes
0
answers
47
views
drop-down( programmatically selecting a option in drop-down menu
so I was trying to click a dropdown option of a site there is the code :
so I was trying to click a dropdown option of a site there is the code :
<ul class="select2-results" role="...
1
vote
1
answer
265
views
Select2 disapears after re-render of Livewire3 Component
I have the following Problem.
When my Livewire3 component renders for the first time my chosen dropdown will be available as an select2. But as soon as I change something in the Livewire Component the ...
0
votes
1
answer
292
views
Populate 2nd Select2 from Selections on 1st Select2 with AJAX and OptGroup
I have my first select2 that I pull data into from remote ajax search with multiple options allowed:
$("#EmailSentToGroup").select2({
ajax: {
url: "/trip-search",
...
0
votes
1
answer
158
views
how to use select2 in yii2 advanced,
When I use select2 in a yii2 form, an error like this always shows:
Invalid Configuration – yii\base\InvalidConfigException
You must install 'yiisoft/yii2-bootstrap' extension for Bootstrap 3.x ...