jQuery: The Write Less, Do More JavaScript Library

UI/Selectables

From jQuery JavaScript Library

Jump to: navigation, search

« Back to the jQuery UI Docs

NameType
Dependencies:

  • ui.base.js

NameType

NameType
Plugin methods:



NameType
selectable( options )
Creates new selectable on the nodeset supplied by the query.
selectable( "disable" ) Returns: jQuery
Temporarily disable the selectable functionality.
selectable( "enable" ) Returns: jQuery
Enable the selectable functionality.
selectable( "toggle" ) Returns: jQuery
Toggles the state of selectable functionality.
selectable( "destroy" ) Returns: jQuery
Completely remove the selectable functionality.
Example:
Basic Example of a selectable. (Draw a box with your mouse to select items.)

$("#myList").selectable();

<!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").selectable();
  });
  </script>
  <style>ul { list-style: none; }
.ui-selected { background: #727EA3; color: #FFF; }
.ui-selecting { border: 1px solid #AAA; }
li { background: #CFD4E6; width: 100px; margin: 5px; font-size: 10px; font-family: Arial; padding: 3px; }</style>
</head>
<body>
  
<script src="http://dev.jquery.com/view/trunk/ui/ui.base.js"></script>
<script src="http://dev.jquery.com/view/trunk/ui/ui.selectable.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