Are events lost in jQuery when you remove() an element and append() it elsewhere?

后端 未结 3 1482
隐瞒了意图╮
隐瞒了意图╮ 2021-02-18 14:35

What happens in jQuery when you remove() an element and append() it elsewhere?

It appears that the events are unhooked - as if you were just inserting fresh html (which

3条回答
  •  走了就别回头了
    2021-02-18 15:32

    use jQuery1.3.1 live() to bind events and you won't need to worry about this..

    Update: live events are deprecated now, but you can get the same effect from $(document).on().

提交回复
热议问题