js 에서 줄 복사 와 줄 삭제 작업 인 스 턴 스


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);
                });
                });
            });
  });

좋은 웹페이지 즐겨찾기