Skip to content

Instantly share code, notes, and snippets.

@donsalvadori
Created June 15, 2015 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donsalvadori/da7ed351acb25237efec to your computer and use it in GitHub Desktop.
Save donsalvadori/da7ed351acb25237efec to your computer and use it in GitHub Desktop.
my jquery code for drag and dropp
$('a').draggable({ containment: "table", revert: 'invalid' });
$('td').droppable({
drop: function(ev, ui) {
var dropped = ui.draggable;
var droppedOn = $(this);
$(droppedOn).droppable("disable");
$(dropped).parent().droppable("enable");
$(dropped).detach().css({top: 0, left: 0}).appendTo(droppedOn);
}
}); $('td').not('td:empty').droppable("disable");
//the <a> element would be the clickable piece, an the <td> element would be the spot on the board.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment