复制代码 代码如下:
var validateForm = null;
  var num = 2;
  $(document).ready(function(){

   var lastCommunAddTr = $("#workDay");

   $("#add").click(function() {

         //复制一行
               var tr = $("#workDay").clone();
               tr.find("#dayMsg1").get(0).style.display="none";
                 tr.find("#remarkMsg1").get(0).style.display="none";
               tr.find("#msg1").get(0).style.display="none";
                tr.find("#day1").get(0).value="";
                tr.find("#dayMsg1").get(0).id="dayMsg"+num;
                tr.find("#day1").get(0).id="day"+num;
                tr.find("#msg1").get(0).id="msg"+num;
                tr.find("#remark1").get(0).value="春节";
               tr.find("#state1").get(0).id="state"+num;
              tr.find("#remark1").get(0).id="remark"+num;
              tr.find("#remarkMsg1").get(0).id="remarkMsg"+num;
               tr.show();
               tr.insertAfter(lastCommunAddTr);
               lastCommunAddTr = tr;
               num++;

            });

            //删除一行
            $("#workDayDel").click(function() {
                var delIndexs = new Array(0);

                $(".trWorkDay:gt(0)").each(function(i) {

                 if($(this).find("#ck").get(0).checked == true){
                  delIndexs.splice(delIndexs.length,0,i);
                     $(this).remove();
                    }
                     $(".trWorkDay").each(function() {

                 lastCommunAddTr = $(this);
                });
                });
            });
  });
标签:
js,复制行,删除行

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com

评论“js中复制行和删除行的操作实例”

暂无“js中复制行和删除行的操作实例”评论...