确实需要帮助
我正在使用 jquery 可排序。
我希望从正在拖动的列表元素中获取 id。
“并非全部都关闭”
这是一个示例 http://jsfiddle.net/isimpledesign/85LdV/1/
这会返回一个数组,但我需要它返回正在拖动的元素的 id,以便我可以将其传递给 php 文件。
有人可以帮我解决这个问题吗???
最佳答案
只是为了澄清乍得的答案 -
$(function() {
$("#sortable").sortable({
update: function(event, ui) {
// i need to get the class text that is being dragged i.e
var order = $(this).sortable("serialize");
alert(order);
/*
No need to bind any other events, ui.item is the dragged
item in 'update' too and we only want to capture the id when the sort
has changed presumably
*/
alert(ui.item.attr('id'));
/*
No need for subscripting, ui.item is a jquery object so
we can just call attr() on it to get the ID
*/
}
});
});
关于jquery 可排序警报此列表 id,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5899361/