Bootstrap5 Toggle No Event Response With jQuery.Clone(True)

I enjoy the practicality of Bootstrap5 Toggle plugin. The purpose of plugin provide user the option to toggle from one Module A to Module B. Each line item is wrap under DIV class .lineitem-wrapper.

Other elements in .lineitem-wrapper includes span and input text which are link to events. Work like a charm.

However, the issue comes with the clone elements of lineitem-wrapper and the toggle plugin stop responding. The other elements like span and input text events are working absolutely fine.

HTML

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code> <div class="row lineitems-wrapper mb-1">
<div class="row lineitem-wrapper mb-1">
<!-- line item module by toggle -->
<div class="col-1 m-0">
<input type="checkbox" class="pm-0 check-moduleId" data-size="sm" checked data-toggle="toggle" data-onlabel="GL" data-offlabel="STK" data-onstyle="primary" data-offstyle="warning">
</div>
<div class="col-3 pm-0 ">
<div class="input-group">
<input type="text" class="form-control input-lineitem-code px-1 " placeholder="Select Stock / GL ">
<!-- the stkgl edit btn -->
<div class="input-group-prepend position-relative">
<span class="input-group-text text-primary mdi mdi-magnify border-bottom-0 px-1 btn-lineitem-edit-stkgl cursor-pointer"> </span>
</div>
</div>
</div>
</div>
codes here...
</code>
<code> <div class="row lineitems-wrapper mb-1"> <div class="row lineitem-wrapper mb-1"> <!-- line item module by toggle --> <div class="col-1 m-0"> <input type="checkbox" class="pm-0 check-moduleId" data-size="sm" checked data-toggle="toggle" data-onlabel="GL" data-offlabel="STK" data-onstyle="primary" data-offstyle="warning"> </div> <div class="col-3 pm-0 "> <div class="input-group"> <input type="text" class="form-control input-lineitem-code px-1 " placeholder="Select Stock / GL "> <!-- the stkgl edit btn --> <div class="input-group-prepend position-relative"> <span class="input-group-text text-primary mdi mdi-magnify border-bottom-0 px-1 btn-lineitem-edit-stkgl cursor-pointer"> </span> </div> </div> </div> </div> codes here... </code>
     <div class="row lineitems-wrapper   mb-1">
     <div class="row lineitem-wrapper   mb-1">
         <!-- line item module by toggle -->
         <div class="col-1 m-0">
            <input type="checkbox" class="pm-0 check-moduleId" data-size="sm" checked data-toggle="toggle" data-onlabel="GL" data-offlabel="STK" data-onstyle="primary" data-offstyle="warning">
         </div>
         <div class="col-3 pm-0 ">
           <div class="input-group">
              <input type="text" class="form-control input-lineitem-code px-1 " placeholder="Select Stock / GL ">
              <!-- the stkgl edit btn -->
              <div class="input-group-prepend position-relative">
                  <span class="input-group-text text-primary   mdi  mdi-magnify  border-bottom-0 px-1 btn-lineitem-edit-stkgl  cursor-pointer"> </span>
              </div>
           </div>
       </div>
    </div>
    
    codes here...

Script

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>$('.btn-lineitem-add-stkgl').on('click' , function(e) {
//clone with event the last lineitem-wrapper
new_lineitemStkGL = $('.lineitems-wrapper').last().find('.lineitem-wrapper').clone(true);
....
//tried the destroy and initialize method but same error
// $('.check-moduleId').bootstrapToggle('destroy');
//$('.check-moduleId').bootstrapToggle();
$('.lineitems-wrapper').append(new_lineitemStkGL);
});
</code>
<code>$('.btn-lineitem-add-stkgl').on('click' , function(e) { //clone with event the last lineitem-wrapper new_lineitemStkGL = $('.lineitems-wrapper').last().find('.lineitem-wrapper').clone(true); .... //tried the destroy and initialize method but same error // $('.check-moduleId').bootstrapToggle('destroy'); //$('.check-moduleId').bootstrapToggle(); $('.lineitems-wrapper').append(new_lineitemStkGL); }); </code>
$('.btn-lineitem-add-stkgl').on('click' , function(e) {
     
         //clone with event the last lineitem-wrapper 
         new_lineitemStkGL = $('.lineitems-wrapper').last().find('.lineitem-wrapper').clone(true);
        ....

        //tried the destroy and initialize method but same error
        // $('.check-moduleId').bootstrapToggle('destroy');
        //$('.check-moduleId').bootstrapToggle();

        $('.lineitems-wrapper').append(new_lineitemStkGL);
});
     

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật