Questions tagged [select2]

Select2 is a jQuery plugin that gives you a customizable select box with support for searching, tagging, remote data sets, infinite scrolling, and many other highly useful options.

The jQuery replacement for select boxes.

Select2 gives you a customizable select box with support for searching, tagging, remote data sets, infinite scrolling, and many other highly useful options.

788 questions
6
votes
2 answers

Binding select2 with knockout

I'm new to knockout and trying to get my select2 to play nicely with my knockout bindings. All I want to do is bind accounts array to my select2 (this works) and then have the initial value set when the binding occurs. I for some reason can not get…
mmLions87
  • 85
  • 1
  • 1
  • 3
6
votes
2 answers

Unable to clone table row with select2 correctly

I have a form for Invoice where I need to add items as required. On clicking on Add button on respective row the row has been appended to previous row. But Select2 not working normally after that. I have tried solution from SO in which destroy…
عثمان غني
  • 2,636
  • 4
  • 46
  • 76
6
votes
1 answer

Select2 Font Awesome Icon on Placeholder

How to add FontAwesome before the placeholder text on Select2. This is my Select2 option code: var placeholder = " " + "Select a places"; $(".select2").select2({ placeholder: placeholder, width: null }); This is…
cocksparrer
  • 221
  • 1
  • 3
  • 16
6
votes
1 answer

select2 multiple prevents other input from submitting form on enter

I have a form with a simple input and a select2 input like so : http://codepen.io/anon/pen/QyBxwE Pressing enter while the first input is focused should submit the form (in this case, redirect to a 404 page). For some reason, the multiple select2…
emi
  • 63
  • 5
5
votes
3 answers

How to use types/select2 in a Angular 2 project?

I am developing Angular 2 project with Typescript. I want to be able to use select2 and I don't see any stable feature rich plugins equivalent to select2. However I came across types/select2 in DefinitelyTyped project. I'm not sure how to use them…
TechCrunch
  • 2,356
  • 3
  • 39
  • 73
5
votes
1 answer

jquery select2 multiselect: How can I check if options is selected or not?

I need to catch these 2 events: first option is selected all options are deselected Reason is - that I want to disable another dropdown (which is responsible for the content of my multiselect) when the first option is selected or all previous…
user1555112
  • 1,697
  • 5
  • 21
  • 41
5
votes
2 answers

Integrating Select2 with Magento 2

I'm trying to integrate Select2 with Magento2. So far I have integrated the plugin successfully but there are errors showing on the console. What I've done: Downloaded the select2.min.js and put it in…
Ian
  • 89
  • 1
  • 3
  • 8
5
votes
5 answers

Forms with Select2 are duplicated when clicking back button on browser in Rails 5

_header.html.erb (for forms part) <%= form_for home_path, class: 'home', role: 'search', method: :get do |f| %>
<%= text_field_tag :q, params[:q],…
5
votes
3 answers

Does select2 dropdown support using ajax and allowing users to enter in new values?

I am using select 2 and it works great. I have an example where as user is chosing from a dropdown via ajax (exactly like the Remote Data example listed in the link) but I want the user to be able to search as well as be able to type in a new value…
leora
  • 163,579
  • 332
  • 834
  • 1,328
5
votes
1 answer

select2 drop-down plugin with auto-populate together with add new record

I'm now working with select2 drop-down plugin. I came situation that I have to add a select2 field which auto populate the existing mail id's in our app. I was able to do so, but I also has to add new mail id's which are not in our app in same…
Sinto
  • 3,710
  • 11
  • 32
  • 59
5
votes
1 answer

Display separate search box in select2 multiselect

When you are using select2 (dropdown jquery framework) you can make fancy dropdowns with jquery. As you can see the single select box has an separate search box but the multiselect has its search box inlined. Is there any possibility to add a…
warch
  • 1,510
  • 1
  • 16
  • 32
5
votes
1 answer

How to save multiple values to database from Select2 Widget Yii2

I am using the kartik - yii2-widget-select2 to allow the option to select multiple options while creating in form. I want to enter two or more rows to the database depending on the the number of options selected in the select2 widget. The select2…
user2211486
  • 227
  • 1
  • 6
  • 15
5
votes
2 answers

Select2 optgroup group on JSON/Ajax format request

Using Select2 with JSON/Ajax call, I am trying to create group like this :
hg8
  • 982
  • 1
  • 13
  • 27
5
votes
1 answer

How to use matcher in select2.js v.4.0.0+?

If I understand correctly, the correct use of matcher before v4.0.0 was: $('#myselect').select2({ ... matcher: function(term, text) { // return true if matches, false if not } }) With 4.0.2 this doesn't work - AFAICT there is…
johndodo
  • 13,994
  • 13
  • 81
  • 105
5
votes
1 answer

Get Select2 Selected Value From Code Behind ASP .Net Web Form

I have a problem with Select2 V 4.02 Here is my code