자바를 이렇게 햇더니..
input만 클릭해도 값이없어도 절로 표출되서요...
소스 공유좀요~
<tr class="layer layer01" style=" display:none;width:650%; float:left; ">
<th scope="row" style="width:15.5% !important; float:left; padding-top: 87px; padding-bottom: 91px;"><label>자격내용</label></th>
<td class="one_t" style="width:84.5%; float:left; ">
<textarea style="height:175px !important; padding-left:0; padding-top:40px;" name="pt_msg2" id="pt_msg2" class="frm_input sl"><?php echo get_text(cut_str($it['pt_msg2'], 250, "")); ?></textarea>
</td>
</tr>
<?php if ($w == '') { ?>
<tr class="layer good_line layer02"><!--폼에적는곳 3개-->
<th scope="row"><label>자격내용</label></th>
<td style="position:relative;">
<div id="pre_set2" class="pre_set2" >
<input placeholder="발행처 예)한국인력공단" id="item21" class="tt21" type="text" name="" value="" style="width:160px; margin-right:5px;" onkeyup="myFunction2()">
<input placeholder="자격증명 예)공인중개사" id="item22" class="tt22" type="text" name="" value="" style="width:277px; margin-right:5px;" onkeyup="myFunction2()">
<input placeholder="교부일 예)24회 2016.01.01" id="item23" class="tt23" type="text" name="" value="" style="width:203px; margin-right:5px;" onkeyup="myFunction2()">
<input type="button" class="meiyou" value="삭제" onclick="remove_item2(this)">
</div>
<div id="field2"></div>
<input style="position:absolute; right:10px; top:13px;" class="plus06" type="button" value=" 추가 " onclick="add_item2()">
</td>
</tr>
<?php } ?>
<script type="text/javascript">
<!--
function add_item2(){
// pre_set2 에 있는 내용을 읽어와서 처리..
var div = document.createElement('div');
div.innerHTML = document.getElementById('pre_set2').innerHTML;
document.getElementById('field2').appendChild(div);
$('#field2>div').addClass("field_div2");
}
function remove_item2(obj){
// obj.parentNode 를 이용하여 삭제
document.getElementById('field2').removeChild(obj.parentNode);
}
//-->
</script>
<!--자격내역 textarea에 값 써지기-->
<script>
function myFunction2() {
var x = '';
$('.pre_set2').each(function() {
x += "\n\n ● 발행처 : " + $('.tt21', $(this)).val() +"\n ○ 자격증명 : " + $('.tt22', $(this)).val() +"\n ○ 교부일 : " + $('.tt23', $(this)).val() + '\n';
});
$('.field_div2').each(function() {
x += "\n ● 발행처 : " + $('.tt21', $(this)).val() +"\n ○ 자격증명 : " + $('.tt22', $(this)).val() +"\n ○ 교부일 : " + $('.tt23', $(this)).val() + '\n';
});
$("#pt_msg2").val(x);
}
</script>