jQuery UI Interaction : Selectable
jQuery UI Interaction : Selectable
Using jQuery Selectable plug-in , you can make a group of element
selectable. In the given below example, we are making list element selectable.
For options, events ,method and theming click here
EXAMPLE
selectable.html
<!DOCTYPE html>
<html>
<head>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui
/1.8/themes/base/jquery-ui.css"
rel="stylesheet" type="text/css"/>
<script src="http://ajax.googleapis.com/ajax/libs/
jquery/1.4/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui
/1.8/jquery-ui.min.js"></script>
<style type="text/css">
#feedback { font-size: 1.4em; }
#selectable .ui-selecting { background: #FECA40; }
#selectable .ui-selected { background: #F39814; color: white; }
#selectable { list-style-type: none; margin: 0; padding: 0; width: 60%; }
#selectable li { margin: 3px; padding: 0.4em; font-size: 1.4em; height: 18px; }
</style>
<script type="text/javascript">
$(function() {
$("#selectable").selectable();
});
</script>
</head>
<div class="demo">
<ol id="selectable">
<li class="ui-widget-content">Element 1</li>
<li class="ui-widget-content">Element 2</li>
<li class="ui-widget-content">Element 3</li>
<li class="ui-widget-content">Element 4</li>
<li class="ui-widget-content">Element 5</li>
<li class="ui-widget-content">Element 6</li>
<li class="ui-widget-content">Element 7</li>
</ol>
</div>
</body>
</html> |
Output :
You can select element/elements by click and also by holding ctrl key
or by holding left key of mouse :
Download Source Code
Click here to see demo
Learn from experts! Attend
jQuery Training classes.