开发者

getting the id of a dragged item JQuery

开发者 https://www.devze.com 2023-02-22 20:27 出处:网络
I would like to get the ID of the item that has been moved on the stop: function below? can someone explain how this is achieved in that function? I am new to JQuery so a good explanation of what is h

I would like to get the ID of the item that has been moved on the stop: function below? can someone explain how this is achieved in that function? I am new to JQuery so a good explanation of what is happening would be welcome. I have tried ui.helper.attr('id'); etc with no joy Thanks.

    $(settings.columns).sortable({
        items: $sortableItems,
        connectWith: $(settings.columns),
        handle: settings.handleSelector,
        placeholder: 'widget-placeholder',
        forcePlaceholderSize: true,
        revert: 300,
        delay: 100,
        opacity: 0.8,
        containment: 'document',
        start: function (e,ui) {
            $(ui.helper).addClass('dragging');
        },

    stop: function (e,ui) {             
    var col = ui.item.parent().parent().children().index(ui开发者_开发问答.item.parent());
    var row = ui.item.parent().children().index(ui.item);
    var movedID =  ????


    alert("ID: " + movedID);   <-----------------------?


            $(ui.item).css({width:''}).removeClass('dragging');
            $(settings.columns).sortable('enable');
        }
    });


try to use $(ui.item).attr('id')

0

精彩评论

暂无评论...
验证码 换一张
取 消