Reputation: 1708
I'm using class to make <ul>
sortable. Now, I need to get the <li>
's data-cube
values in current <ul>
.
Currently I'm using '#sortable2 li' but I would like to use something like ($(this) + ' li')
but Is not working.
$("ul.droptrue").sortable({
connectWith: "ul",
receive: function (event, ui) {
var sum = 0;
var listItems = $("#sortable2 li");
listItems.each(function (idx, li) {
var product = $(li);
sum += product.data("cube");
});
}
});
Upvotes: 1
Views: 80
Reputation: 43156
You can access the <li>
's of receiver <ul>
inside receive callback like
$(this).find("li");
or
$(this).children("li");
Upvotes: 1