간단한 질문하나 드립니다
본문
<thead>
<tr>
<th>요금제<span id="add_charge">+</span></th>
<th>기본요금</th>
<th>공시지원금</th>
<th>신규가입</th>
<th>번호이동</th>
<th>기기변경</th>
<th>데이터</th>
<th>음성</th>
<th>문자</th>
</tr>
</thead>
<tbody>
<tr>
<td><input type="text" name="it_11[1]" value="<?php echo $it_11[1] ?>"></td>
<td><input type="text" name="it_11[2]" value="<?php echo $it_11[2] ?>"></td>
<td><input type="text" name="it_11[3]" value="<?php echo $it_11[3] ?>"></td>
<td><input type="text" name="it_11[4]" value="<?php echo $it_11[4] ?>"></td>
<td><input type="text" name="it_11[5]" value="<?php echo $it_11[5] ?>"></td>
<td><input type="text" name="it_11[6]" value="<?php echo $it_11[6] ?>"></td>
<td><input type="text" name="it_11[7]" value="<?php echo $it_11[7] ?>"></td>
<td><input type="text" name="it_11[8]" value="<?php echo $it_11[8] ?>"></td>
<td><input type="text" name="it_11[9]" value="<?php echo $it_11[9] ?>"></td>
</tr>
</tbody>
<script>
$(function(){
$('#charge').on('click', 'span[id="add_charge"]', function() {
var $contents = $('#charge tr:last');
var $clone = $contents.clone();
$clone.find('input').val("");
$("#charge").append($clone);
});
});
</script>
+버튼을 눌렀을때 밑에 처럼 동적으로 필드를 생성하고 name과 value의 it_숫자+1[1,2,3,4,5,6,7,8,9]
이 되게 하고싶습니다.
<tr>
<td><input type="text" name="it_12[1]" value="<?php echo $it_12[1] ?>"></td>
<td><input type="text" name="it_12[2]" value="<?php echo $it_12[2] ?>"></td>
<td><input type="text" name="it_12[3]" value="<?php echo $it_12[3] ?>"></td>
<td><input type="text" name="it_12[4]" value="<?php echo $it_12[4] ?>"></td>
<td><input type="text" name="it_12[5]" value="<?php echo $it_12[5] ?>"></td>
<td><input type="text" name="it_12[6]" value="<?php echo $it_12[6] ?>"></td>
<td><input type="text" name="it_12[7]" value="<?php echo $it_12[7] ?>"></td>
<td><input type="text" name="it_12[8]" value="<?php echo $it_12[8] ?>"></td>
<td><input type="text" name="it_12[9]" value="<?php echo $it_12[9] ?>"></td>
</tr>
답변을 작성하시기 전에 로그인 해주세요.