function binding and the clone() function - Jquery

后端 未结 3 1102
慢半拍i
慢半拍i 2021-01-14 11:22

I have problems with my keyup binding when cloning an element. Here\'s the scenario:

I have an html markup like this:


          


        
3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-14 11:33

    You've got two real options

    • use clone(true) which will also clone the bound event handlers
    • use event delegation with live() so that the event handler is bound to a parent element and thus newly added rows will get the same functionality

提交回复
热议问题