I'm sorry if this is super simple but I just cannot see what is wrong but the update event (or any event I have tried) is not firing in sortable. I tried to create a simple test using just the basic example they provide but it still fails. Can anyone help?
HTML:
<ol class='example'>
<li>First</li>
<li>Second</li>
<li>Third</li>
</ol>
My main.js
$(document).ready(function() {
$("ol.example").sortable({
update:function(event, ui){
alert("in the update");
}
});
})
The closest open issue I found was Why is sort the only event firing for jQuery UI .sortable()?. But that still isn't the helping. I have also tried using binding for the event which also failed. I am using jquery version 1.9.1 in case that matters.
I think you've a problem in the include of the jQuery librairies, please try to Replace :
<script type="text/javascript" src="jslib/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="jslib/jquery-ui.min.js"></script>
<script type="text/javascript" src="jslib/jquery-sortable.js"></script>
By :
<script type="text/javascript" src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
If it work so verify the librairies inside jslib folder.
Full working code :
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
<head>
<body>
<ol class='example'>
<li>First</li>
<li>Second</li>
<li>Third</li>
</ol>
<script>
$(document).ready(function() {
$("ol.example").sortable({
update:function(event, ui){
alert("in the update");
}
});
});
</script>
</body>
</html>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With