jquery-select2-3

Is there a way to add a description to each option in a dropdown using select2?

佐手、 提交于 2020-06-26 19:43:27
问题 I have a Django project in which I have a select dropdown like this: But I want something like this: My <select> form looks like so: (after inspecting in developer tools) <select class="form-control" data-parsley-required="true" id="id_org_role" name="org_role" required=""> <option value="A">Administrator</option> <option value="M" selected="selected">Member</option> </select> If not select2, is there any other jquery library that can help me accomplish this? I have tried following the

select2 multiple versions on same page/site

≡放荡痞女 提交于 2019-12-18 07:16:32
问题 Afternoon, On a website I already updated lots of elements that used select2 v. 3.5.2 to the new v. 4.0 (and some of those elements are on the header of the website that is present on ALL pages) Unfortunately on some pages of the website the X-editable jquery plugin is used, and that plugin doesn't play well with v 4.0 of select2 (please read: does not play at all) My question is: Can I use both versions of select2 on some pages? And if so, how? Since $(...).select2(); is blind to which

maximumSelectionSize isn't working in Select2

被刻印的时光 ゝ 提交于 2019-12-08 19:39:32
问题 I have a multivalue select, and I want to set the restriction on number of selected items using the select2 library. Documentation says that I should set maximumSelectionSize during the object initialization. Unfortunately, the following code doesn't work: $(document).ready(function () { $("#select_demo").select2({ maximumSelectionSize: 3 }); }); My html selectbox: <div class="form-group"> <select id="select_demo" multiple="multiple" class="form-control select2 select2-container-multi">

Select2 Ajax Method Not Selecting

☆樱花仙子☆ 提交于 2019-11-27 17:39:57
Ok, I'm sure there's something simple set wrong here but I'm not 100% what it is. So I am trying to use Select2 AJAX method as a way of users to search a database and select a result. The call itself is coming back with results, however it will not allow me to select the answer from the list. It also doesn't seem to allow you to "select" it on hover or up/ down arrow. So without further ado, here is my code: index.html <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="select2/select2.css" media=

Select2 Ajax Method Not Selecting

柔情痞子 提交于 2019-11-26 19:07:58
问题 Ok, I'm sure there's something simple set wrong here but I'm not 100% what it is. So I am trying to use Select2 AJAX method as a way of users to search a database and select a result. The call itself is coming back with results, however it will not allow me to select the answer from the list. It also doesn't seem to allow you to "select" it on hover or up/ down arrow. So without further ado, here is my code: index.html <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9