如何在shapeshift jquery中获取drop项的id

时间:2014-11-22 10:38:12

标签: javascript jquery ajax shapeshift

我也希望从服务器端删除一个项目,因此我需要id项目转到trash div,下面的方法在被放到trash div时被调用。< / p>

drop: function(e, selected) {
              var $current_container, $original_container, $previous_container;
              if (_this.options.enableTrash) {
                  alert(original_container_class);
                $original_container = $("." + original_container_class);
                $current_container = $("." + current_container_class);
                $previous_container = $("." + previous_container_class);
                $selected = $(selected.helper);
                $current_container.trigger("ss-trashed", $selected);
                $selected.remove();
                $original_container.trigger("ss-rearrange").removeClass(original_container_class);
                $current_container.trigger("ss-rearrange").removeClass(current_container_class);
                return $previous_container.trigger("ss-arrange").removeClass(previous_container_class);
              }
            }

FIDDLE:  http://jsfiddle.net/LNysC/2244/

1 个答案:

答案 0 :(得分:1)

试试这个

$('.trash').on('ss-trashed', function (e, selected) {
    console.log($(selected).attr('id'))
})

DEMO:http://jsfiddle.net/LNysC/2245/