Cloning a bootstrap element with an event listener

后端 未结 4 1537
既然无缘
既然无缘 2021-01-11 13:37

I\'m trying to clone a bootstrap element that has data-toggle behavior provided by bootstrap:

HTML

&
4条回答
  •  死守一世寂寞
    2021-01-11 14:12

    Don't copy the events while cloning, remove the true flag.

    var header = objectContainer.clone();
    

    My guess is Bootstrap is handling the event binding of dynamic objects also for data-toggle, it only needs to have different id's & target.

    Here's a fiddle.

    PS: Don't know what was this or objectContainer in OP's question, so created a closure and pasting result in new wrapper.

提交回复
热议问题