Cloned Select2 is not responding

前端 未结 13 2384
长发绾君心
长发绾君心 2020-11-29 03:51

I am trying to clone a row which contains select2 tool ,when i clone that row using jQuery the cloned select2 is not responding.In image given below first select2 which is o

13条回答
  •  借酒劲吻你
    2020-11-29 04:27

    I solved this problem with it:
    Call destroy method before you add new row

     $(".className").select2("destroy");  //Destroy method , connect with class no ID (recomend)
    

    After it call select2 jQuery function:

    $(".className").select2({               
                    placeholder: "Example",
                    allowClear:true 
                });
    

    hope it helps ;)

提交回复
热议问题