Skip to content

Instantly share code, notes, and snippets.

@chadothompson
Created February 19, 2013 20:38
Show Gist options
  • Save chadothompson/4989709 to your computer and use it in GitHub Desktop.
Save chadothompson/4989709 to your computer and use it in GitHub Desktop.
A Gist showing the use of "detatch" for JQuery UI drop events.
jQuery(".case").droppable({
hoverClass: "highlightNewcase",
drop: function (event, ui) {
// Don't submit if the ID is currently a child
var selectedDocumentId = jQuery(ui.draggable).attr('id').split('_')[1];
var selectedCaseId = jQuery(this).attr('id').split('_')[1];
var documentsParentCaseId = jQuery(ui.draggable.parent()).attr('id').split('_')[1];
if (selectedCaseId != documentsParentCaseId) {
ui.draggable.detach();
documentTabPost('CRFilingCaseDetail.do?action=ADD_DOCUMENT&selectedCaseId=' + selectedCaseId + '&selectedDocumentId=' + selectedDocumentId, null);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment