I am using jQuery Sortable. I have the HTML setup like so:
- 1
- 2
The trigger method accepts extra parameters, so if you need the ui parameter, you’ll need to pass that in yourself. But you usually just want the target ui.item, and in this case, you know what that is:
var sortupdate = function (event, ui) {
// do something with ui.item
};
var $plan = $("#plan");
$plan.sortable({
update: sortupdate
});
$plan.on("sortupdate", sortupdate); // sortupdate is not automatically bound
var $item = $("#plan li:eq(1)");
$item.insertAfter($("#plan li:eq(2)"));
$plan.trigger("sortupdate", { item : $item });
Demo:
http://jsfiddle.net/D7fCz/3/