tags:

views:

56

answers:

1

I have the following code in jQuery...

$("#sortable2").sortable({
    connectWith: '.connectedSortable',
    dropOnEmpty: true,
    receive: function (event, ui) {
        var colNum = $(ui.item).attr("id").replace(/col_/, "");
        $.post("/Category/Insert", { title: colNum });
    },

the var colNum = $(ui.... ) this gets the id from the item being dragged. I was wondering, is it possible for me to get the id of the container it is being dropped in?

+3  A: 

As the dropped item is inside and direct descendant of the container, you can access the container using the parent() method:

var parent_id = $(ui.item).parent().attr('id');
Tatu Ulmanen
Thank you. Thank you so much.
Stacey