jquery-chosen

Chosen.js and validate jquery

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 08:36:18
I am using validate.jquery.js : works fine. But when I'm adding chosen.js , validation on the select dropdowns doesn't work anymore. Here is the JS I'm using http://pastebin.com/S9AaxdEN And here is my select form : <select name="category" id="category" placeholder="" class="{validate:{required:true}}"> <option value=""><?php echo lang('category_choice'); ?></option> <option value="vtt">VTT</option> <option value="autre">Autre type de vélo</option> </select> Don't know why chosen.js disable the validation, any idea ? You can fix this by adding the class "chzn-done" that does not take the

JSON format for jquery-select2 multi with ajax

我与影子孤独终老i 提交于 2019-11-30 08:18:27
I'm thinking in moving from Chosen to Select2 because Select2 has native methods for ajax. Ajax is critical because usualy you have to load a lot of data. I executed sucessfully the example with the JSON of api.rottentomatoes.com/api/ I did a JSON file to test the ajax, but it didn't works. I don't know how the JSON should be. It seems that there is no detailed documentation: https://github.com/ivaynberg/select2/issues/920 I tried unsucessfully several JSON formats, so I tried to copy a JSON format similar to api.rottentomatoes but it doesn't works. I may be missing something stupid. function

Is there a way to dynamically ajax add elements through jquery chosen plugin?

匆匆过客 提交于 2019-11-30 06:57:11
问题 I am trying to use "Chosen" plugin by harvest (http://harvesthq.github.com/chosen/) and it works for the static set of options I am passing. However, what I want is that whenever anybody types something that is not in the pre-filled options, then it should send that to the server as a new option and on successful response, I want to not only add that to the valid list of options, but also make it select it. Reloading the options is fairly simple: // In ajax response var newOption = new Option

Changing selection in a select with the Chosen plugin

↘锁芯ラ 提交于 2019-11-30 06:21:07
问题 I'm trying to change the currently selected option in a select with the Chosen plugin. The documentation covers updating the list, and triggering an event when an option is selected, but nothing (that I can see) on externally changing the currently selected value. I have made a jsFiddle to demonstrate the code and my attempted ways of changing the selection: $('button').click(function() { $('select').val(2); $('select').chosen().val(2); $('select').chosen().select(2); }); 回答1: From the

Chosen dropdown within Bootstrap modal is hidden behind modal footer

懵懂的女人 提交于 2019-11-30 02:45:50
问题 I am using a modal based on the example from twitter bootstrap. I have a select element that uses chosen. When the chosen select drops down, it is cut off by the modal footer. I tried to add the z-index value on the chosen elements, but nothing works. I'm looking at it in tilt, and wonder if it is just because the select element is with divs that are before the modal footer div? I'm using the default CSS from chosen and bootstrap for this as well, so I haven't modified anything. example. HTML

'select all' and 'remove all' with chosen.js

时光毁灭记忆、已成空白 提交于 2019-11-30 00:04:19
For the select menu plugin chosen.js , is there an established way to add 'select all items in list' or 'remove all items in list' feature to a multiple select input? In the main branch or perhaps in one of the forks? Or has someone done this before has some tips? Wesley Murch It should be pretty straight forward, just do it the "normal" way first: $('.my-select-all').click(function(){ $('#my_select option').prop('selected', true); // Selects all options }); Then trigger the liszt:updated event to update the chosen widget, so the whole thing would look something like this: Update : For those

Chosen Jquery Plugin - getting selected values

谁说我不能喝 提交于 2019-11-29 20:25:08
How can i get the selected values from the chosen Multi-select Box? Sergii Like from any regular input/select/etc...: $("form.my-form .chosen-select").val() $("#select-id").chosen().val() Arvind This worked for me $(".chzn-select").chosen({ disable_search_threshold: 10 }).change(function(event){ if(event.target == this){ alert($(this).val()); } }); user3423551 $("#select-id").chosen().val() this is the right answer, I tried, and the value passed is the values separated by "," If anyone wants to get only the selected value on click to an option, he can do the follow: $('.chosen-select').on(

How can I Clone Chosen Plugin

倖福魔咒の 提交于 2019-11-29 17:52:28
I wanted to use http://harvesthq.github.com/chosen/ witch jquery clone function: <script type="text/javascript"> $(function(){ var removeLink = ' <a class="remove" href="#" onclick="$(this).parent().slideUp(function(){ $(this).remove() }); return false">remove</a>'; $('a.add').relCopy({ append: removeLink}); }); </script> <form method="post" action=""> <div id="cloner"> <p class="clone"> <script type="text/javascript"> jQuery(document).ready(function(){ jQuery(".chzn-select").data("placeholder","Search...").chosen(); }); </script> <select data-placeholder="Search..." name="actor_name[]" class=

JSON format for jquery-select2 multi with ajax

那年仲夏 提交于 2019-11-29 11:22:30
问题 I'm thinking in moving from Chosen to Select2 because Select2 has native methods for ajax. Ajax is critical because usualy you have to load a lot of data. I executed sucessfully the example with the JSON of api.rottentomatoes.com/api/ I did a JSON file to test the ajax, but it didn't works. I don't know how the JSON should be. It seems that there is no detailed documentation: https://github.com/ivaynberg/select2/issues/920 I tried unsucessfully several JSON formats, so I tried to copy a JSON

Is there a way to dynamically ajax add elements through jquery chosen plugin?

半城伤御伤魂 提交于 2019-11-28 23:22:07
I am trying to use "Chosen" plugin by harvest (http://harvesthq.github.com/chosen/) and it works for the static set of options I am passing. However, what I want is that whenever anybody types something that is not in the pre-filled options, then it should send that to the server as a new option and on successful response, I want to not only add that to the valid list of options, but also make it select it. Reloading the options is fairly simple: // In ajax response var newOption = new Option("Text", __value__); $("#tagSelection").append(newOption); $("#tagSelection").trigger("liszt:updated");