jquery droppable only one child -


i new jquery , working droppable api.

i want have group of divs can hold 1 , 1 droppable item. i've set class of droppable divs inv. can drop items divs can find way reject drop once in drop function.

i want able detect div has child , if revert dopped element.

my code looks this

$( "div.inv" ).droppable( {     drop: function( event, ui )      {         childcount = $(this).children().length;         if (childcount !=0)         {             //revert droppable initial position             return;         }              //if there child revert , return          $( )             .addclass( "ui-state-highlight" )             .append($(ui.draggable))     } }); 

what disabling droppable area after receiving item ?

you can :

$( "div.inv" ).droppable( {     drop: function( event, ui )  {         $(this).droppable('disable');     } }); 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -