开发者

jquery droppable accept where not parent

I'm trying to figure out how to write a statement which will stop the jQuery droppable function if the the dragged element is the parent.

Basically what I have is a table, and each cell has the id of x-axis:eq+'-'+y-axis:eq. (x over-x-down). When the user drags an element to a different 开发者_运维知识库cell, I update the info, so if you drag from cell 3-3 to 3-4, I update the data.

However, if the user starts dragging from 3-3, and then stops dragging still within the 3-3 cell, I want to prevent the droppable function from firing.

I've been looking at using the 'accept' function, but can't figure out how to say !jQuery('td#3-3')

Here's what I've got

jQuery('div','table').draggable({axis:'y', containment: 'table'});
var cellId=jQuery(this).parents('td').attr('id');
jQuery('td','table').droppable({
           accept : !jQuery('td#'+cellId),
           drop: function(){
              jQuery.ajax({ update stuff in db});
            }

         });


try

$('.myselector').droppable({ accept: 'td:not(#' + cellId +')' });
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜