jQuery UI sortable on select options

11,886

Workind demo for select options sorting using multiselect js widget: http://jsfiddle.net/QRv6d/9/

good link: https://github.com/yanickrochon/jquery.uix.multiselect http://quasipartikel.at/2009/05/10/jqueryui-multiselect/ & http://quasipartikel.at/multiselect/

please note: I cannot find any simple sortable implementation of sortable() with select boxes hence using this multiselect plugin and as you can see in demo it does work :) you can use it according to your need. full HTML is in js fiddle.

Hope this helps,

script source

  <script type="text/javascript" src="http://quasipartikel.at/multiselect/js/ui.multiselect.js"></script>

code

  $(function(){

            $(".multiselect").multiselect();

        });​

HTML

<select id="countries" class="multiselect" multiple="multiple">

    <option value="AUT" selected="selected">Austria</option>
    <option value="DEU" selected="selected">Germany</option>

    <option value="NLD" selected="selected">Netherlands</option>

    <option value="USA" selected="selected">United States</option>


  </select>

Image

enter image description here

Share:
11,886
user1038814
Author by

user1038814

Updated on June 28, 2022

Comments

  • user1038814
    user1038814 almost 2 years

    I'm trying to get jQuery UI default sortable to work on options in a select multi list box but can't seem to get it working. Can this work with a select option? I've only seen examples with <li> everywhere.

    Here's my JavaScript:

    $(function() {
        $( "#secondSelectms2side__dx" ).sortable();
        $( "#secondSelectms2side__dx" ).disableSelection();
    });
    

    And the HTML:

    <select title="" name="secondSelectms2side__dx" id="secondSelectms2side__dx" size="8" multiple="multiple">
        <option value="4">asdsdsds</option>
        <option value="10">bsdsdsdsd</option>
        <option value="2">csdsdsds</option>
    </select>​
    

    My code is on jsFiddle:

    http://jsfiddle.net/noscirre/DRUPe/

  • user1038814
    user1038814 almost 12 years
    Thanks for that. I'll try and adapt that. Cheers
  • Howie
    Howie over 8 years
    Dead links @Tats_innit
  • Tats_innit
    Tats_innit over 8 years
    Shot bro @Howie . I have updated the link bruv, Will look into the demo, but you can actually see the git repo to check it out.