Now i'm using jQuery library and i faced the folowing problem: Supppose i have the sortable list if items
<html>
<head>
<script src=".js"></script>
<script src=".4/jquery.min.js> </script>
<script src=".8/jquery-ui.min.js"></script>
<script>
$(document).ready(function(){
jQuery(".block").sortable({
axis: 'y'
});
});
</script>
</head>
<body>
<ul class="block" type="none">
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</body>
</html>
So ofter order changed, how can i make listener for this event, i mean ,is there any listener for order changed event or something like this.
Now i'm using jQuery library and i faced the folowing problem: Supppose i have the sortable list if items
<html>
<head>
<script src="http://code.jquery./jquery-latest.js"></script>
<script src="http://ajax.googleapis./ajax/libs/jquery/1.4/jquery.min.js> </script>
<script src="http://ajax.googleapis./ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script>
$(document).ready(function(){
jQuery(".block").sortable({
axis: 'y'
});
});
</script>
</head>
<body>
<ul class="block" type="none">
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</body>
</html>
So ofter order changed, how can i make listener for this event, i mean ,is there any listener for order changed event or something like this.
Share Improve this question asked Aug 1, 2012 at 7:18 ilya.stmnilya.stmn 1,6245 gold badges23 silver badges41 bronze badges 1- 1 Ya! there is check the documentation of jquery ui sortable. – SVS Commented Aug 1, 2012 at 7:20
2 Answers
Reset to default 7It's right there in the documentation. Use the change
or update
event:
$(document).ready(function(){
$(".block").sortable({
axis: 'y',
change: function(event, ui) {
console.log('change', event, ui);
},
update: function(event, ui) {
console.log('update', event, ui);
}
});
});
Also either use jQuery
or $
, don't mix them.
Yes,
$( ".selector" ).bind( "sort", function(event, ui) {
...
});
Directly from the documentation.