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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.