Hi,
I have this code....it's using scriptaculous dragging.
<span id="droppable1_2" class="space">
_______________
<div id="draggable_8" class="de_small">low-pitched</div>
</span>
The span is the droppable zone which is hard-coded and the div is the
draggable element that has been dropped here.
What i'm trying to do is detect if a droppable zone already has a
draggable piece in it (This will be in a function that fires when a
piece is dragged on the dropzone....if the dropzone already has a
draggable peice in there it will be deleted and the new one will
replace it).
Problem is i can't seem to access this draggable piece once it's been
dropped.
I've got a reference to the span. IN the code below it's assigned to
the variable dropp. So i'm ttrying to access the draggable piece in
the code above:
I've tried:
var ooo = $(dropp).next('.de_small');
var ooo = $(dropp).next(0);
var ooo = $(dropp).next(1);
var ooo = $(dropp).down(0);
var ooo = $(dropp).down('de_small');
But none work.....I should be able to access the piece even though
it's been inserted in to the droppable span on the fly right???
on 2008-07-03 14:16
on 2008-07-03 14:48
Element#next is for siblings, not children, so that won't work.
$(dropp).down('.de_small') should work (you left out the dot - your
version
looks for an element named <de_small>. $(dropp).down(0) seems like it
should work, as should $(dropp).down() with no parameters, as long as
there
are no other children in that span.
-Fred
On Thu, Jul 3, 2008 at 7:15 AM, elduderino
<jamesfiltness@googlemail.com>
wrote:
>
> var ooo = $(dropp).next('.de_small');
> var ooo = $(dropp).next(0);
> var ooo = $(dropp).next(1);
> var ooo = $(dropp).down(0);
> var ooo = $(dropp).down('de_small');
>
> But none work.....I should be able to access the piece even though
> it's been inserted in to the droppable span on the fly right???
--
Science answers questions; philosophy questions answers.