버튼클릭 텍스트 여분 필드추가 채택완료
http://superkts.pe.kr/helper/view.php?seq=V&seq=290">http://superkts.pe.kr/helper/view.php?seq=V&seq=290
처럼 a,b,c,d 로 나누어서
a팀 버튼클릭시 필드 계속 추가 , 버튼클릭 ...
b팀 버튼클릭시 필드 계속 추가 , 버튼클릭 ...
c팀 버튼클릭시 필드 계속 추가 , 버튼클릭
d팀 버튼클릭시 필드 계속 추가 , 버튼클릭
이렇게 만들고 싶은데 혹시 스킨이나 예제 등이 있는지 질문드립니다 ^^;
댓글을 작성하려면 로그인이 필요합니다.
답변 1개
채택된 답변
+20 포인트
8년 전
</p>
<p><script type="text/javascript">
$(function() {
var c = "", n, nn;
$("input[type='button']").on("click", function() {
c = $(this).prev("input").attr("name").split("_");
n = $(this).siblings("input[name^='" + c[0] + "']:last").attr("name").split("_");
nn = parseInt(n[1]) > 1 ? parseInt(n[1]) + 1 : 2;
$(this).parent("div").append("<input type='text' name='" + c[0] + "_" + nn + "' /><input type='button' value='삭제' class='rem' />");
});</p>
<p> $("body").on("click", "input.rem", function() {
$(this).prev().remove();
$(this).remove();
});
});
</script>
<div><input type="text" name="awr_1" /><input type="button" value="추가" /></div>
<div><input type="text" name="bwr_1" /><input type="button" value="추가" /></div>
<div><input type="text" name="cwr_1" /><input type="button" value="추가" /></div>
<div><input type="text" name="dwr_1" /><input type="button" value="추가" /></div></p>
<p>
js로 하면 길어지고 해서 jquery로...
http://nyaongii.dothome.co.kr/temp/wrid_216556.html">http://nyaongii.dothome.co.kr/temp/wrid_216556.html
로그인 후 평가할 수 있습니다
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인전체 질문 목록
채택
채택
채택
답변대기
채택
채택
채택
답변대기
답변대기
답변대기
채택
채택
채택
채택
채택
채택
채택
답변대기