如何维护所选的选定顺序并按所选顺序传递值

如何维护所选的选定顺序并按所选顺序传递值

本文介绍了如何维护所选的选定顺序并按所选顺序传递值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<div>
    <em><label for="multiple-label-example">Click to Highlight Multiple Select</label></em>
    <select id="multiple-label-example" name="cond-fields[]" tabindex="-1" style="width: 350px; display: none;" class="chosen-select" multiple="" data-placeholder="Your Favorite Types of Bear">
        <option value=""></option>
        <option>American Black Bear</option>
        <option>Asiatic Black Bear</option>
        <option>Brown Bear</option>
        <option selected="">Giant Panda</option>
        <option>Sloth Bear</option>
        <option>Sun Bear</option>
        <option>Polar Bear</option>
        <option>Spectacled Bear</option>
    </select>
    <div class="chosen-container chosen-container-multi" style="width: 350px;" title="" id="multiple_label_example_chosen">
        <ul class="chosen-choices">
            <li class="search-choice"><span>Giant Panda</span>
                <a class="search-choice-close" data-option-array-index="4"></a>
            </li>
            <li class="search-field">
                <input type="text" style="width: 25px;" autocomplete="off" class="" value="Your Favorite Types of Bear" tabindex="18">
            </li>
        </ul>
        <div class="chosen-drop">
            <ul class="chosen-results">
                <li class="active-result" style="" data-option-array-index="1">American Black Bear</li>
                <li class="active-result" style="" data-option-array-index="2">Asiatic Black Bear</li>
                <li class="active-result" style="" data-option-array-index="3">Brown Bear</li>
                <li class="result-selected" style="" data-option-array-index="4">Giant Panda</li>
                <li class="active-result" style="" data-option-array-index="5">Sloth Bear</li>
                <li class="active-result" style="" data-option-array-index="6">Sun Bear</li>
                <li class="active-result" style="" data-option-array-index="7">Polar Bear</li>
                <li class="active-result" style="" data-option-array-index="8">Spectacled Bear</li>
            </ul>
        </div>
    </div>
</div>

如何维持所选的所选订单。
i在我的表格中选择以下订单棕熊,亚洲黑熊,大熊猫,美国黑熊

how to maintain the selected order of chosen.i select the following order in my form Brown Bear, Asiatic Black Bear , Giant Panda , American Black Bear

但它传递的价值如下

cond-fields[]  - American Black Bear
cond-fields[]  - Asiatic Black Bear
cond-fields[]  - Brown Bear
cond-fields[]  - Giant Panda

如何维护所选订单并按所选订单传递价值,
演示链接

how to maintain the selected order and pass the value by selected order ,the demo link is http://harvesthq.github.io/chosen/

推荐答案

这个问题已经存在在这里说:

This question has already been addressed here:




  • Chosen jQuery plugin : get multiple select values in the order they were clicked
  • Chosen: Keep Multiple Selection Order

这篇关于如何维护所选的选定顺序并按所选顺序传递值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 03:50