jQuery Example: Selecting items with drag and drop

Some time ago, I needed to take a list of items and select from them a subset, put that subset of items into a particular order, and then submit them to the server. A good example would be when you have a list of posts and you need to choose which ones (and in which order) you want to print them. Drag and Drop is a breeze with jQuery and jQuery UI.

Here is a video of it in action:

This was very easy to do with just a small amount of code. Here is the setup:

…and the code:

Once you’ve selected your items, it’s just a matter of POSTing the #postOrder input element to your server with a list of the IDs and their corresponding order.

Demo: Selecting items with drag and drop

5 thoughts on “jQuery Example: Selecting items with drag and drop

  1. Pingback: jQuery Example: Inserting text with drag n’ drop « SKFox.com

  2. Its good example for drag and drop list items. It helped me very much in my project. Thanks a lot

  3. How can i disable reordering in one listbox. for example in i don’t need reordering option in first listbox. ie, sortable1. Can anyone help me?. Thanks in advance

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.