html - jquery inverse of div selector -
i'm trying event when user selects row , drops outside jquery grid. drop function drag/drop happens within grid, works fine -
$(".grid-canvas") .on("drop", function (e, dd) { // somecode });
i'm trying track drag & drop happening "anywhere" outside grid canvas div. inverse selection not seem working. tried this, not working -
$(".grid-canvas") .not(this) .on("drop", function (e, dd) { alert("outside"); });
i tried this, triggers drag & drops within grid -
$(":not(.grid-canvas)") .on("drop", function (e, dd) { alert("outside"); });
any appreciated. thanks.
target document directly drops, , filter out nested inside .grid-canvas
(probably more efficient pseudo selectors) :
$(document).on('drop', function(e, dd) { if ( ! $(e.target).closest('.grid-canvas').length ) { // dropped outside } });
Comments
Post a Comment