Jump to content

jQuery droppable() get new parent container


jcanker

Recommended Posts

I'm trying to get the id of the parent container of the dragged/dropped element.  Currently it is reporting only the original container it was in before it was dragged the first time, regardless of how many times it is dragged.

Here's the relevant code:

//make the batter and baserunners draggable
	$('.batter').draggable({
		start: function() {
                     $("#5-4").html("we dragged");
		     $(this).css({"margin-top":"0px"})
                },
		stop:function(){
			alert($(".batter").parent().attr('id'));
		}//end stop function
	});//end batter draggable

A container DIV is broken into smaller DIVs making a 5x5 grid.  Each of those DIVs have an ID corresponding to ROW-COL, e.g. the upper most box is id='1-1', the first box in the 3rd row is id='3-1', the last box in the 3rd row is id='3-5'.

 

Currently it only reports 5-3, the starting location.  

Sample up at http://alpha.centraldbs.com/html/scorekeeper/scorekeeper.html

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.