Javascript Drag-and-Drop Ordered Lists

By , 1 September 2004

Javascript Drag-and-Drop Ordered Lists

Yet another "couldn't already find this web thing on the Internet" discovery. Using a modified version of Youngpup's DOM-Drag, I created a list that you can reorder in the DOM by dragging and dropping elements around:

drag and drop

  • Foo
  • Bar
  • Baz
  • Quux

The really nice thing about doing it in the DOM, rather than just moving the positions around, is that you can then create a form which encodes the new order, by inspecting the elements of the list at submit time. I'll be using this to provide an editable playlist for Songbee. The next step is, of course, to be able to drag new songs onto the playlist from a separate list of available songs.

Javascript Drag-and-Drop Ordered Lists

About Roger Keays

Javascript Drag-and-Drop Ordered Lists

Roger Keays is an artist, an engineer, and a student of life. He has no fixed address and has left footprints on 40-something different countries around the world. Roger is addicted to surfing. His other interests are music, psychology, languages, the proper use of semicolons, and finding good food.

Leave a Comment

Please visit https://rogerkeays.com/javascript-drag-and-drop-ordered-lists to add your comments.