Questions tagged [jquery-select2]
Select2 is a jQuery-based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results.
5,565
questions
0
votes
0
answers
7
views
How to create a tag with the same text value?
I am using Select2's multi select functionality with the tags option to let users enter new values. I need the ability to let a user enter a "tag" with the same text as an existing option. ...
-2
votes
0
answers
22
views
How to use select2 to change the default browser hover color?
Okay I have literally no clue what I'm doing but I've been trying to change the default blue color to a different custom color but I'm struggling with attaching the select2 to the properties, since it'...
0
votes
1
answer
49
views
Clone <tr> tag table with jquery
I have this form
<form method="POST" id="postPengajuan">
<div class="modal-body">
<div class="row">
<div class="col-xl-6 ...
1
vote
1
answer
27
views
How to remove duplicate tags from grouped options select2?
I have 2 grouped options with a duplicate tag.
When selected, the tags appears twice, from each group.
How to avoid this duplicate entry ?
I have prepared a jsFiddle that demonstrates the problem.
...
0
votes
0
answers
10
views
Select2 the indentation of the search input is hidden behind the tag
.select2-container .select2-search__field This search field is having an inline style for the input.
In my scenario I am using select2 for multiple selections and after selecting a tag, I start to ...
0
votes
3
answers
34
views
stopPropagation and preventDefault don't work with select2 for remove tags button
I want to prevent click propagation on the following element:
.select2-selection__choice__remove
I try this:
$(document).ready(function () {
$("document").on(
"mouseup",
...
0
votes
0
answers
13
views
sonata admin 4 custom js not working events
I see that the v4 sonata uses Webpack - I add
{% block sonata_javascript_pool %}
{% for javascript in sonata_config.getOption('javascripts', []) %}
<script src=&...
0
votes
0
answers
13
views
Search records only in options select2
I have multi-level optgroup in my select2 box.
I would like to search items only in <option></option> tags.
Any suggestion?
0
votes
0
answers
39
views
Old values from multiple select in Laravel 10 and select2
In my Laravel project, I am using select2, in order to have a simple filter system. One of the things I want to do is keep the old values in the input after filtering (and keep them selected in the ...
-1
votes
0
answers
9
views
Select2 dropdown not showing proper place
Select2 dropdown nit showing in proper place
I used dropdownParent , but not working. I tried in bootstrap3
Select2 dropdown nit showing in proper place I used dropdownParent , but not working. I ...
0
votes
0
answers
8
views
How to create a tag with custom properties programmatically?
I want to create a Select2 tag programmatically. I have a function set for the createTag config option, which adds a property to the Select2 selection that I later use to distinguish existing options ...
0
votes
0
answers
11
views
Mac Voiceover repeats selectWoo dropdown twice
The selectWoo library is supposed to be a more accessible version of select2, which is a JS/CSS library that allows you to style dropdowns. However, I'm finding that Mac Voiceover repeats dropdown ...
0
votes
2
answers
74
views
How to sort results select2 tags alphabetically?
I would like to sort alphabetically (case insensitive), the tags choosen from a select2.
I have used the sorter function to sort the tags to be selected but once selected they are not displayed ...
0
votes
0
answers
7
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 ...
0
votes
0
answers
13
views
Select 2 how to add color badge in option value
I use select2 library and I try add badge color in option. But this badge is not displayed.
<select id="select2B" class="form-select" style="width: 60%;">
<...
0
votes
1
answer
32
views
How to get random background colors on a select2 tags?
I would like to have multiple tags with different colors on a select2.
It can be done with
$('#select2Skills').select2({
tags: true,
multiple: true,
allowClear: true,
...
0
votes
1
answer
26
views
Select2 Dropdown Not Displaying Options Inside Modal, But Works Outside Modal
I'm facing an issue with the Select2 dropdown within a modal in my web application. The problem is that when I place the Select2 dropdown inside a modal, it only displays a single option, but when I ...
0
votes
0
answers
40
views
variation product attribute dropdowns display the attribute slugs instead of names
To change the behavior of WooCommerce's variation product attribute dropdowns (when editing product) to display the attribute slugs instead of names, we need to modify the wc-enhanced-select.min.js ...
0
votes
1
answer
13
views
Yii2 GridView with Kartik Select2 as filter shows only once
I have a standard Yii2 GridView and want to use in two different grid columns Kartic Select2 widget as filter. But it will be shown only once in one column. In the second column the filter will be ...
0
votes
0
answers
30
views
(JS, PHP, LARAVEL) -> SELECT2 oldValue is null when i try edit and save
saya mempunyai kendala saat melakukan edit data namun terdapat beberapa data yang valuenya tidak dapat muncul.
Help me sir, i have problem with form and select2 function, but some data can't showed or ...
0
votes
0
answers
33
views
pagination in using Select2 4.0
I trying to create pagination in using Select2 4.0
js code without pagination working good
$("#CatID").select2({
placeholder: "Please type at least 3 characters",
...
0
votes
1
answer
26
views
Select2 add onchange
I am using vuexy theme in my Laravel project. I want to add onchange to the select2 input I'm using, but I couldn't.
My select2;
<div class="col-12 mb-2">
<label class="form-...
0
votes
0
answers
16
views
update data with select2 not working what is missing?
I have form:
<form action="" id="update-loc-of-product">
<div class="form-group">
<label for="" ...
0
votes
0
answers
17
views
Django Autocomplete Light Select2 generates multiple selectboxes for declarative field
I was expecting to see a single functioning widget, but instead have two partially functioning ones.
I have a Work and a Parent Work; each Work can have 0 or 1 ParentWork.
models.py
class ParentWork(...
0
votes
1
answer
84
views
How to insert placeholder in Django Admin autocomplete input?
I don't want to use my own JS or alter the template when Django has other mechanisms.
I've tried three methods, first as described in
how-to-add-placeholder-text-to-a-django-admin-field and in the ...
0
votes
1
answer
28
views
Filling a select2 with given send to javascript
On an application I created a form with a field (select) in EntityType, I then passed it to select2, no problem there.
The twig view looks like an array of all saved helpers and you can modify a ...
0
votes
1
answer
29
views
Select2 TypeError: Cannot use 'in' operator to search for 'status' in undefined on ajax request
I'm trying to make a select2 with ajax on my Laravel project and this is happening:
error in the console
error line
This is my js:
import 'select2';
let baseurl = window.location.origin;
$(window)....
0
votes
0
answers
34
views
cannot type any text in search select2 using modal
When I try to search the dropdown list from Select2, I can't type any text inside it.
Here is my html:
<div class="mb-3 custom-select2" id="branch_field">
<label class=&...
0
votes
0
answers
75
views
dynamically adding options to select2 in blade component with laravel livewire and alpinejs
When I dynamically update the options inside of a select 2, the dropdown isn't getting updated. Based on this, I've tried emitting an event that I'm then listening for in my select2 component to ...
-1
votes
1
answer
45
views
Uncaught TypeError: jQuery(...).counterUp is not a function error while trying to retrieve data from select2 select option
I have a select2 multiple boxes containing data of "package_name" and value of "price" compacted from my Laravel controller, and 2 textboxes for total price and ordered_pacakage, I ...
0
votes
0
answers
10
views
Parameter valueAccesor select2 knockout.js comes undefined
I have two select2 on my page. Both configured as multiple. When doing the custom binding using ko.bindingHandlers.select2 .... the valueAccessor parameter corresponding to a select2 comes undefined. ...
1
vote
1
answer
43
views
Select2 destroying itself when adding another element to DOM
I have a form with a single select field. I have attached select2 to it. Through Javascript I'm adding/removing more such fields in the client itself. Randomly, one of the added fields loses the ...
0
votes
0
answers
27
views
The data of select 2 is misaligned
I have this modal with bootstrap 5 and select 2 but moving the modal messes up any selection and I don't know how to fix the data so it doesn't go elsewhere.
In the selects that are first, they are ...
0
votes
1
answer
105
views
Bootstrap 5 is not working after I using Select2 dropdown
The Select2 functionality is functioning correctly. However, there is an issue with Bootstrap, after using Select2, Bootstrap is not working anymore. I am using Bootstrap 5.3.The picture show that the ...
0
votes
1
answer
16
views
Select2 Multi Dropdownlist not loading all selected values
Good morning,
I have a DropdownListFor with multiple selections. When I submit the form, it posts fine with all of the selected values, but if there are any model errors when the screen reloads only ...
0
votes
1
answer
33
views
Prevent writing different symbols into select2 input
I have default select:
<select id="indivCitizen" multiple="multiple">
<option value=""></option>
</select>
Which I replace with select2:
$(...
0
votes
0
answers
31
views
Select2 How hide optgroup on search matcher
IN select2 i need to search values by data attributes, and i use function matcher: select2MatchOverride:
function select2MatchOverride(params, data) {
if ($.trim(params.term) === '') {
return data;
}...
0
votes
0
answers
12
views
Select2 does not allow you to enter text into the input if set to multiple => false But all OK if multiple => true
I need to set to page Select2. If I set 'multiple' => false in the configuration, then in the displayed Select2 cannot enter text and search. If you put 'multiple' => true, then everything works ...
0
votes
0
answers
15
views
Loading an eModal with JS select2 init in the ajax fetch content does not get called the first time
I have taken over a project and have the following problem.
When the button is clicked to load the eModal, the JS in the file that is fetched via ajax to make a select into a select2 multiple is not ...
0
votes
1
answer
46
views
Select2 Grouped Data Remove and Add rows doesn't work
I have this jquery select2 with data that is grouped but I can't seem to be able to add and remove rows (data) from it.
I have this working when the data is not grouped but when grouped it is an issue....
0
votes
0
answers
15
views
Select2 dropdown value stored, But not showing in UI
This image shows the value showing in dropdown, but not in the input field.
the value is not showing till i click the options.
this image shows that the value is stored as an array, but not showing ...
0
votes
1
answer
42
views
Select2 Dropdowns intermittent loading of previous data
I am struggling with an issue regarding dropdowns for an edit page I have created. The text fields are fine and always load, however the dropdowns are really intermittent and sometimes load some of ...
0
votes
0
answers
40
views
Programmatically setting value in Select2 with AJAX data retrieval when minimum input length is defined
I have a select2 which is defined with minimum input length and ajax call (remote data) to retrieve data from server based on user input.
$('#itemList').select2({
minimumInputLength: 3,
ajax: {...
0
votes
0
answers
17
views
select2 create tag if is not in dropdown list
I'm sorry I looked over the documentation and searched other examples and I can not figure it out.. I want to check if the entered value exists in dropdown and if not, to add it to the dropdown and ...
0
votes
0
answers
44
views
Autocomplete dropdown not rendering on safari
I am developing a modal form, where select2 ui is used for an input field with id="location", but the dropdown list seems not to appear only in Safari.
I tested the autocomplete on Google ...
0
votes
0
answers
28
views
How to save the select2 items after making it sortable
I'm trying to make the following select2 selection field in laravel voyager admin panel sortable with sortable.js.
<select id="selected-items" class="...
0
votes
0
answers
44
views
Problem with select2 in angularjs, select2 is displayed but does not work
I using adminlte template, it is includes select2.
for using select2 I created a directive to init select2:
select2.directive.ts
import { Directive, ElementRef, AfterViewInit } from '@angular/core';
...
0
votes
1
answer
49
views
How to save client data first and reservation next, with a single onpostasync on .net 7 core and select2, when the client does not exists?
1. Expaination
The app is a Razor pages, Web Api on .net7.0 with bootstrap5 and select2 javascript.
Through a table and a popup button, i can successfully save reservations, when the client exists.
...
0
votes
1
answer
11
views
how to pass dynamic array of object values to select2 package on vue.js2
i want to make a searchable select on vue.js2, so i found package called "select2"
i could make it work if its options are on a single array
but i had an array of object, and i want just ...
0
votes
0
answers
11
views
Select2 still has --focus class when select is disabled
I'm using select2 and i disabled one of my selects but bcs of library select2 i've got class select2-container--focus on span but when i try to get this span and remove this class i've got null
html
&...