我有一个选择的下拉菜单。我更改了选项内容和调用触发选择:更新,但选择不重建下拉列表。这是我的更新
06000
<ul class="chzn-results"> <li id="select_shortcode_chzn_o_1" class="active-result" style="">7183</li> <li id="select_shortcode_chzn_o_2" class="active-result" style="">7983</li> <li id="select_shortcode_chzn_o_3" class="active-result" style="">8208</li> <li id="select_shortcode_chzn_o_4" class="active-result" style="">8308</li> </ul>
这是我的jQuery代码:
$('#select_shortcode_mask').change(function(){ var shortcode_mask = $('#select_shortcode_mask').val(); $('#select_shortcode').empty(); var shortcode = {"7X83":["7183","7983"],"8x08":["8208","8308"]}; $('#select_shortcode').append("<option value=''></option>"); if(jQuery.isArray(shortcode[shortcode_mask])){ $.each( shortcode[shortcode_mask],function( subkey,subvalue ) { $('#select_shortcode').append("<option value='"+subvalue+"'>"+subvalue+"</option>"); }) } else { var full_shortcode = ["7183","7983","8208","8308"]; if(jQuery.isArray(full_shortcode)){ $.each(full_shortcode,subvalue ) { $('#select_shortcode').append("<option value='"+subvalue+"'>"+subvalue+"</option>"); }) } } $("#select_shortcode").trigger("chosen:updated"); });
解决了:
我使用旧版本,所以应该:
$("#select_shortcode").trigger("liszt:updated");
所以转储^^