반응형
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | var count1 = 0; var count2 = 0; var count3 = 0; function addTd(tableId){ tableId = tableId; if(tableId == "spa-light-tb"){ $("<tr id='spa_tr_"+count1+"' >").appendTo($("#spa-light-tb")) .append("<td><select class='form-control input-sm' name='' id='' title=''><option value=''>선택</option></select></td>") .append("<td><input class='form-control input-sm' name='OtdpotDetailVOList["+count1+"].lght_cnt' maxlength='25' placeholder='수량을 입력하세요' title=''></td>") .append("<td><input class='form-control input-sm' name='OtdpotDetailVOList["+count1+"].sot_knd_code' maxlength='25' placeholder='광원을 입력하세요' title=''></td>") .append("<td><input class='form-control input-sm' name='OtdpotDetailVOList["+count1+"].cnsmp_pwrer' maxlength='25' placeholder='소비전력[W]을 입력하세요' title=''></td>") .append("<td><select class='form-control input-sm' name='' id='' title=''><option value=''>선택</option></select></td>") .append("<input type='hidden' name='OtdpotDetailVOList["+count1+"].lght_no' value='"+$("#lght_no").val()+"'>") .append("</tr>"); count1++; }else if(tableId== "adv-light-tb"){ $("<tr id='adv_tr_"+count2+"' >").appendTo($("#adv-light-tb")) .append("<td><input class='form-control input-sm' name='OtdpotDetailVOList["+count2+"].sot_knd_code' maxlength='25' placeholder='광원종류를 입력하세요' title=''></td>") .append("<td><input class='form-control input-sm' name='OtdpotDetailVOList["+count2+"].lght_color' maxlength='25' placeholder='광원색상을 입력하세요' title=''></td>") .append("<td><select class='form-control input-sm' name='' id='' title=''><option value=''>선택</option></select></td>") .append("<input type='hidden' name='OtdpotDetailVOList["+count2+"].lght_no' value='"+$("#lght_no").val()+"'>") .append("</tr>"); count2++; }else if(tableId == "deco-light-tb"){ $("<tr id='deco_tr_"+count3+"' >").appendTo($("#deco-light-tb")) .append("<td><input class='form-control input-sm' name='OtdpotDetailVOList["+count3+"].sot_knd_code' maxlength='25' placeholder='광원종류를 입력하세요' title=''></td>") .append("<td><input class='form-control input-sm' name='OtdpotDetailVOList["+count3+"].lght_color' maxlength='25' placeholder='광원색상을 입력하세요' title=''></td>") .append("<td><select class='form-control input-sm' name='' id='' title=''><option value=''>선택</option></select></td>") .append("<td><select class='form-control input-sm' name='' id='' title=''><option value=''>선택</option></select></td>") .append("<input type='hidden' name='OtdpotDetailVOList["+count3+"].lght_no' value='"+$("#lght_no").val()+"'>") .append("</tr>"); count3++; } }//end addId function remTd(tableId){ if(tableId == "spa-light-tb"){ count1--; $("#spa_tr_"+count1+"").remove(); }else if(tableId == "adv-light-tb"){ count2--; $("#adv_tr_"+count2+"").remove(); }else if(tableId == "deco-light-tb"){ count3--; $("#deco_tr_"+count2+"").remove(); } }//end subTd | cs |
반응형
'Programming Language > Javascript' 카테고리의 다른 글
html 프린트출력용 자바스크립트 메소드 (0) | 2018.03.13 |
---|---|
[Javascript] onchange()로 html 요소의 값이 변경될 때마다 특정 함수를 호출하기 / escape 사용 (0) | 2018.03.08 |
[Javascript] 한국어 정규식 동 이름 추출 (0) | 2018.01.25 |
(스크랩)Javascript 기초 - Object prototype 이해하기 (0) | 2017.12.06 |
[Javascript] Form 데이터 문자열로 변환 시, serialize() 사용하기 (0) | 2017.10.12 |