When you use .html() to replace the contents it removes the old
contents, including any event handlers. You will need to "reattach"
the event handlers on the "new" content.

http://docs.jquery.com/Frequently_Asked_Questions#Why_doesn.27t_an_event_work_on_a_new_element_I.27ve_created.3F

Karl Rudd

On Thu, May 15, 2008 at 9:09 PM, Gildas <[EMAIL PROTECTED]> wrote:
>
> Hello!
>
> I'm trying to switch the content of two div when I drop one on
> another.
> Each "tbody tr" are clickable (and then I use toggleClass() on it) in
> order to select lines.
>
> Here is my problem :
> When I switch two div, lines are no more clickable in one of the two
> table.
>
> My jQuery :
> $('.block')
>        .droppable({
>                accept: 'table',
>                activeClass: 'droppable-active',
>                hoverClass: 'droppable-hover',
>                tolerance : 'pointer',
>                drop: function(ev, ui) {
>                        var droppableContent = $(this).children().eq(0);
>                        var droppableContainer = $(this);
>
>                        var draggableContent = $
> (ui.draggable).parents("div").children().eq(0);
>                        var draggableContainer = 
> $(ui.draggable).parents("div").eq(0);
>
>                        console.log(droppableContent); //[table#hardware]
>                        console.log(droppableContainer); //[div#bloc1.block]
>                        console.log(draggableContent); //[table#ipaddress]
>                        console.log(draggableContainer); //[div#bloc3.block]
>
>                        droppableContainer.html(draggableContent);
>                        draggableContainer.html(droppableContent); //Lines are 
> no more
> clickable in draggableContainer
>                }
> });
>
> I will be very very glad for your help !
>
> --Gildas
>

Reply via email to