Click upload of html added by layui.upload.render with js is invalid

            $("-sharpadd_link").click(function(){
                var link_html = "<div class=\"linkAll_inn\">" +
                    "<div class=\"activity_theme\">" +
                        "<div class=\"activity_theme_text \"><span class=\"xing\">*</span></div>" +
                        "<input type=\"text\" placeholder=\"\" class=\"activity_theme_input w391 position17\" id=\"speaker\">" +
                    "</div>" +
                    "<div class=\"activity_theme \">" +
                        "<div class=\"activity_theme_text\"><span class=\"xing\">*</span></div>" +
                        "<textarea placeholder=\"\" class=\"activity_theme_area position-17\" id=\"speakerDesc\"></textarea>" +
                    "</div>" +
                    "<div class=\"activity_theme\">" +
                        "<div class=\"activity_theme_text \"><span class=\"xing\">*</span></div>" +
                        "<input type=\"text\" placeholder=\"\" class=\"activity_theme_input w391 position34\" id=\"source\">" +
                    "</div>" +
                    "<div class=\"activity_theme\">" +
                        "<div class=\"activity_theme_text\"><span class=\"xing\">*</span></div>" +
                        "<input type=\"text\" placeholder=\"\" id=\"demo-2\" class=\"activity_theme_input w191\" id=\"startDate\" value=\"\">" +
                    "</div>" +
                    "<div class=\"activity_theme\">" +
                        "<div class=\"activity_theme_text\"><span class=\"xing\">*</span></div>" +
                        "<input type=\"text\" placeholder=\"\" id=\"demo-4\" class=\"activity_theme_input w191\" id=\"endDate\">" +
                    "</div>" +
                    "<div class=\"activity_theme\">" +
                        "<div class=\"activity_theme_text\"><span class=\"xing\"></span></div>" +
                        "<button class=\"fil_mp4 layui-btn videos\"><i class=\"layui-icon\"></i></button>" +
                    "</div>" +
                    "<div class=\"activity_theme\">" +
                        "<div class=\"activity_theme_text\"><span class=\"xing\"></span></div>" +
                        "<div class=\"layui-upload\">" +
                          "<button type=\"button\" class=\"layui-btn layui-btn-normal fil_mp4\" id=\"testList\"></button>" +
                          "<div class=\"layui-upload-list\">" +
                            "<table class=\"layui-table\">" +
                              "<thead>" +
                                "<tr><th></th>" +
                                "<th></th>" +
                                "<th></th>" +
                                "<th></th>" +
                              "</tr></thead>" +
                              "<tbody id=\"demoList\"></tbody>" +
                            "</table>" +
                          "</div>" +
                          "<button type=\"button\" class=\"layui-btn\" id=\"testListAction\" style=\"background:-sharp1a95f0;color:-sharpfff;\"></button>" +
                        "</div>" +
                    "</div>" +
                    "<div class=\"hr_add\"></div>" +
                "</div>";

                $(".linkAll").append(link_html);
            });

            // 
            layui.use("upload", function(){
                var $ = layui.jquery;
                var upload = layui.upload;

                //
                upload.render({

                    elem: ".videos" //
                    ,url: "/upload/" //
                    ,accept: "video"
                    ,done: function(res){
                        //
                    }
                    ,error: function(){
                        //
                    }

                });

                upload.render({

                    elem: ".texts" //
                    ,url: "/upload/" //
                    ,done: function(res){
                        //
                    }
                    ,error: function(){
                        //
                    }

                });

                var demoListView = $("-sharpdemoList");
                  var uploadListIns = upload.render({
                    elem: "-sharptestList"
                    ,url: "${linkPrefix}/onlineClass/video" //
                    ,accept: "file"
                    ,multiple: true
                    ,auto: false
                    ,bindAction: "-sharptestListAction"
                    ,choose: function(obj){
                      var files = obj.pushFile(); //
                      //
                      obj.preview(function(index, file, result){
                        var tr = $(["<tr id="upload-"+ index +"">"
                          ,"<td>"+ file.name +"</td>"
                          ,"<td>"+ (file.size/1014).toFixed(1) +"kb</td>"
                          ,"<td></td>"
                          ,"<td>"
                            ,"<button class="layui-btn layui-btn-mini demo-reload layui-hide"></button>"
                            ,"<button class="layui-btn layui-btn-mini layui-btn-danger demo-delete"></button>"
                          ,"</td>"
                        ,"</tr>"].join(""));

                        //
                        tr.find(".demo-reload").on("click", function(){
                          obj.upload(index, file);
                        });

                        //
                        tr.find(".demo-delete").on("click", function(){
                          delete files[index]; //
                          tr.remove();
                        });

                        demoListView.append(tr);
                      });
                    }
                    ,done: function(res, index, upload){
                      if(res.code == 0){ //
                        var tr = demoListView.find("tr-sharpupload-"+ index)
                        ,tds = tr.children();
                        tds.eq(2).html("<span style="color: -sharp5FB878;"></span>");
                        tds.eq(3).html(""); //
                        delete files[index]; //
                        return;
                      }
                      this.error(index, upload);
                    }
                    ,error: function(index, upload){
                      var tr = demoListView.find("tr-sharpupload-"+ index)
                      ,tds = tr.children();
                      tds.eq(2).html("<span style="color: -sharpFF5722;"></span>");
                      tds.eq(3).find(".demo-reload").removeClass("layui-hide"); //
                    }
                  });
                });
Mar.02,2021

you can enclose the upload method in a function, and then call it after each stitching is completed. The stitching can only be replaced directly with append, and only the last one is valid. Class does not know that id is generated by splicing anyway. Give it a try. I just used it. A lot of trouble,-_-| |

function uploadFile(id,number,name){
              upload.render({
                  elem: id
                  ,url: ''
                  ,auto: false //
                ,multiple: true    //
< H1 >} < / H1 >
twoInfo+='<div class="goodsImgs czl_slidImg slidImgUpload"><img src="images/404.png" alt="" /><div class="czl_imgShadow"><div class="goodsReplaceImg" id="czl_goodsTableUploads'+data[index].spec_value[i].id+'" ></div><div class="goodsDelImg"></div></div>';
                    twoInfo+='</td>';
                    twoInfo+='</tr>';

                    $(".tbody").append(twoInfo);
                    uploadFile("-sharpczl_goodsTableUpload"+data[index].spec_value[i].id,1,"ddsd");//
                    
                    
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1be7b5c-544fb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1be7b5c-544fb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?