jquery-chosen

Clear and refresh jQuery Chosen dropdown list

↘锁芯ラ 提交于 2019-11-27 06:39:27
I'm trying to clear jQuery Chosen dropdown list and refresh it. HTML: <select data-placeholder="Select Picture..." class="chosen-select" style="width:250px;" id="picturegallery" tabindex="2"> <option value="" selected="selected"></option> <option value="x">remove me</option> </select> When I click "Refresh" button, it should turn into this: <select data-placeholder="Select Picture..." class="chosen-select" style="width:250px;" id="picturegallery" tabindex="2"> <option value="1">test</option> </select> What I have tried: $("#refreshgallery").click(function(){ $('#picturegallery').empty(); var

How do I reset a jquery-chosen select option with jQuery?

≡放荡痞女 提交于 2019-11-27 06:26:39
I have tried numerous things and nothing seems to be working. I am using jQuery and Chosen plugin. Methods I have tried: var select = jQuery('#autoship_option'); select.val(jQuery('options:first', select).val()); jQuery('#autoship_option').val(''); jQuery('#autoship_option').text(''); jQuery('#autoship_option').empty(''); jQuery("#autoship_option option[value='']").attr('selected', true); It always shows the Active Autoship option once it has been selected. I can't seem to get it to clear the selection. Here is the select box: <select id="autoship_option" data-placeholder="Choose Option..."

jQuery Chosen reset

送分小仙女□ 提交于 2019-11-27 05:13:53
问题 I have a bunch of select elements in a form with which I am using the Jquery Chosen plugin. How can I reset the form? The following does not work: <input type="reset" /> 回答1: You'll need to reset the value of the field, then trigger the liszt:updated event on the input to get it to update, ive made a fiddle with a working example here. http://jsfiddle.net/VSpa3/3/ $(".chzn-select").chosen(); $('a').click(function(){ $(".chzn-select").val('').trigger("liszt:updated"); });​ Since the release of

Jquery Chosen plugin - dynamically populate list by Ajax

て烟熏妆下的殇ゞ 提交于 2019-11-27 05:11:44
问题 Im trying to build my dropdown menu using the plugin Chosen for Multiple Select . Here's to behavior I'm based on: http://jsfiddle.net/JfLvA/ So, instead of having 3 harcoded < option > in my select. I want this list to be the values of a json array populated by an ajax request. This will be triggered by autocomplete. So, if the user type "car", im sending the letter via an ajax call, and im getting back an array like that: [{"id":"2489","name":"carrie"},{"id":"2490","name":"Caroline"},{"id":

How can I use jQuery validation with the “chosen” plugin?

白昼怎懂夜的黑 提交于 2019-11-27 03:09:26
I have some <select> inputs using the chosen plugin that I want to validate as "required" on the client side. Since "chosen" hides the actual select element and creates a widget with divs and spans, native HTML5 validation doesn't seem to work properly. The form won't submit (which is good), but the error message is not shown, so the user has no idea what's wrong (which is not good). I've turned to the jQuery validation plugin (which I planned on using eventually anyways) but haven't had any luck so far. Here's my test case : <form> <label>Name: <input name="test1" required></label> <label

jQuery Chosen plugin add options dynamically

本小妞迷上赌 提交于 2019-11-27 01:26:56
问题 I make a jQuery Chosen drop-down like this: $('.blah').chosen(); I can't find how I can add options, something like: $('.blah').chosen('add', name, value); 回答1: First, you need to add the <option> s to the <select> that Chosen was bound to. For example: $('.blah').append('<option value="foo">Bar</option>'); Then, you need to trigger the chosen:updated event: $('.blah').trigger("chosen:updated"); More information can be found here (although you need to scroll down to Change / Update Events ).

chosen with bootstrap 3 not working properly

荒凉一梦 提交于 2019-11-27 00:43:10
问题 I have this code which triggers a bootstrap modal and load its content via $.load() . the page I'm loading has a select element which I'm calling chosen on. Here's the code: $('.someClick').click(function(e){ e.preventDefault(); x.modal('show'); x.find('.modal-body').load('path/page.html', function(response, status, xhr){ if(status =="success") $("select[name=elementName]").chosen(); }); }); the results I'm getting is like the following image: and this is my Html content: <select name=

Validating select box with jquery validate and chosen plugins

旧时模样 提交于 2019-11-26 21:59:13
问题 I am trying to use validate and chosen plugin together. I am having the problem while validating select boxes. I found similar questions How can I use jQuery validation with the "chosen" plugin? and Chosen.js and validate jquery but I couldn't find a way to import the solutions to my code : <form class='myform' id='producteditform'> <input type='hidden' value='<? echo $row['id']; ?>' name='pkedit' id='pkedit'> <input type='hidden' value='save' name='operation' id='operation'> <p><label for=

How do I reset a jquery-chosen select option with jQuery?

折月煮酒 提交于 2019-11-26 12:54:13
问题 I have tried numerous things and nothing seems to be working. I am using jQuery and Chosen plugin. Methods I have tried: var select = jQuery(\'#autoship_option\'); select.val(jQuery(\'options:first\', select).val()); jQuery(\'#autoship_option\').val(\'\'); jQuery(\'#autoship_option\').text(\'\'); jQuery(\'#autoship_option\').empty(\'\'); jQuery(\"#autoship_option option[value=\'\']\").attr(\'selected\', true); It always shows the Active Autoship option once it has been selected. I can\'t seem

Clear and refresh jQuery Chosen dropdown list

假如想象 提交于 2019-11-26 12:06:23
问题 I\'m trying to clear jQuery Chosen dropdown list and refresh it. HTML: <select data-placeholder=\"Select Picture...\" class=\"chosen-select\" style=\"width:250px;\" id=\"picturegallery\" tabindex=\"2\"> <option value=\"\" selected=\"selected\"></option> <option value=\"x\">remove me</option> </select> When I click \"Refresh\" button, it should turn into this: <select data-placeholder=\"Select Picture...\" class=\"chosen-select\" style=\"width:250px;\" id=\"picturegallery\" tabindex=\"2\">