jQuery: The Write Less, Do More JavaScript Library

UI/Sortables

From jQuery JavaScript Library

Jump to: navigation, search

« Back to the jQuery UI Docs

NameType
Dependencies:

  • ui.base.js

NameType

NameType
Plugin methods:




NameType
sortable( options )
Creates new sortable on the nodeset supplied by the query.
sortable( "disable" ) Returns: jQuery
Temporarily disable the sortable functionality.
sortable( "enable" ) Returns: jQuery
Enable the sortable functionality.
sortable( "destroy" ) Returns: jQuery
Completely remove the sortable functionality.
sortable( "serialize", options ) Returns: String
Serializes the sortable's item id's into a form/ajax submittable string.
sortable( "refresh" ) Returns: jQuery
Refresh the sortable items.
sortable( "refreshPositions" ) Returns: jQuery
Refresh the cached positions of the sortables' items.

NameType
Example:
Basic Example of a sortable.

$("#myList").sortable({});

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
  
  <script>
  $(document).ready(function(){
    $("#myList").sortable({});
  });
  </script>
  <style>ul { list-style: none; }
li { background: #727EA3; color: #FFF; width: 100px; margin: 5px; font-size: 10px; font-family: Arial; padding: 3px; }</style>
</head>
<body>
  
<script src="http://dev.jquery.com/view/tags/ui/1.5b2/ui.base.js"></script>
<script src="http://dev.jquery.com/view/tags/ui/1.5b2/ui.sortable.js"></script>
<ul id="myList">
	    <li>Item 1</li>
	    <li>Item 2</li>
	    <li>Item 3</li>
	    <li>Item 4</li>
</ul>

</body>
</html>


NameType

NameType
Demos:

NameType