Ticket #5935 (closed bug: invalid)
Attached events is lost on empty()
| Reported by: | petter@… | Owned by: | |
|---|---|---|---|
| Priority: | trivial | Milestone: | |
| Component: | core | Version: | 1.4 |
| Keywords: | eventhandling empty | Cc: | |
| Blocking: | Blocked by: |
Description
This might not be a bug, but i'm filing it here anyway...
$("selector").click(doSomething);
works fine ofcours..
But if I take an element that has this event attached, moves and does
$("#someElement").append(someElementWithClick); the click event still works on both elements.
But if I do $("#someElement").empty(); the click event is removed from the original element..
The problem is solved by adding a .clone() $("#someElement").append(someElementWithClick.clone());
So I'm not sure if this is a bug or a feature.. :)
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Can you put together a complete test case and reopen with an attachment? Thanks!