我正在使用 Chosen jquery 插件,我有两个选择字段,一个是source
,另一个是target
<select data-placeholder="Source language" class="chzn-select" id="os_source" style="width:200px;">
<option value=""></option>
<option value="246">Somali</option>
<option value="239">Swahili</option>
<option value="259">Zulu</option>
<option value="237">Tigrinya</option>
<option value="261">Afrikaans</option>
<option value="236">Amharic</option>
<option value="265">Polish</option>
<option value="241">Czech</option>
<option value="3476">English</option>
<option value="281">German</option>
<option value="285">Romanian</option>
<option value="243">Arabic</option>
<option value="299">Chinese</option>
<option value="401">French</option>
<option value="402">Italian</option>
<option value="403">Russian</option>
<option value="404">Spanish</option>
<option value="405">Turkish</option>
</select>
<select data-placeholder="Target language" class="chzn-select" id="os_target" multiple style="width:200px">
<option value=""></option>
<option value="246">Somali</option>
<option value="239">Swahili</option>
<option value="259">Zulu</option>
<option value="237">Tigrinya</option>
<option value="261">Afrikaans</option>
<option value="236">Amharic</option>
<option value="265">Polish</option>
<option value="241">Czech</option>
<option value="3476">English</option>
<option value="281">German</option>
<option value="285">Romanian</option>
<option value="243">Arabic</option>
<option value="299">Chinese</option>
<option value="401">French</option>
<option value="402">Italian</option>
<option value="403">Russian</option>
<option value="404">Spanish</option>
<option value="405">Turkish</option>
</select>
我想在选择相同的源语言时隐藏目标语言(当用户在源中选择英语时,英语在目标中消失等等)
怎么能做到呢?
$('#os_source').chosen().change(function() {
var source = $(this).val();
$('.chzn-results').val(source).hide();
$("#os_target").trigger("liszt:updated");
});