자바스크립트 자식 변수 질문드립니다. 채택완료
고가형가죽
10년 전
조회 4,081
자식 변수 갯수를 자동으로 세서 값으로 쓸려 하는대요. 감이 잘 안잡혀서요.
</p><p style="margin-left: 40px;">var test = $(div.test01 > div);</p><p style="margin-left: 40px;"> </p><p style="margin-left: 40px;">test01.hide();???????</p><p style="margin-left: 40px;"><span style="font-size: 13.3333330154419px; line-height: 1.5;">test02.hide();???????</span></p><p style="margin-left: 40px;"><span style="font-size: 10pt; line-height: 1.5;"></span><span style="font-size: 13.3333330154419px; line-height: 1.5;">test03.hide();???????</span><span style="font-size: 10pt; line-height: 1.5;"></span></p><p style="margin-left: 40px;"><span style="font-size: 10pt; line-height: 1.5;"></span><span style="font-size: 13.3333330154419px; line-height: 1.5;">test04.hide();??????</span></p><p>
자식 변수는 어떻게 선언해야 하나요???
댓글을 작성하려면 로그인이 필요합니다.
답변 1개
채택된 답변
+20 포인트
10년 전
</p><p><div class="test"></p><p> <div></div></p><p><span style="font-size: 13.3333330154419px; line-height: 1.5;"> <div></div></span></p><p><span style="font-size: 13.3333330154419px; line-height: 1.5;"> <div></div></span></p><p><span style="font-size: 13.3333330154419px; line-height: 1.5;"> <div></div></span></p><p><span style="font-size: 13.3333330154419px; line-height: 1.5;"> <div></div></span></p><p></div></p><p> </p><p><script></p><p>var divCnt$(".test div").size(); // test아래의 div의 갯수</p><p>for(var i = 0; i < <span style="font-size: 13.3333330154419px; line-height: 1.5;">divCnt</span><span style="font-size: 10pt; line-height: 1.5;">; i++){</span></p><p><span style="font-size: 10pt; line-height: 1.5;"> $(".test div").eq(i); // test아래의 div의 i번째를 선택</span></p><p><span style="font-size: 10pt; line-height: 1.5;">}</span></p><p><span style="font-size: 13.3333330154419px; line-height: 1.5;"></script></span><span style="font-size: 10pt; line-height: 1.5;"></span></p><p>
로그인 후 평가할 수 있습니다
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인