티스토리 뷰
$('선택자').each(함수);
원리는 for문과 비슷하다.
// jQuery
$('.el_boxUnit > div').each(function (idx) {
$(this).css({width: '100px', height: '100px'});
})
});
// idx는 JS for문의 i와 같다.
// JS
const $el_boxUnit_children = document.querySelector('.el_boxUnit').children;
for (let i = 0; i < $el_boxUnit_children.length; i++) {
$el_boxUnit_children[i].style.width = '100px';
$el_boxUnit_children[i].style.height = '100px';
}
See the Pen [jQuery] 반복문 .each() by mill (@millfeel) on CodePen.
[공부좌표]
jQuery 06 [ each 메서드 ] jQuery hover animation, 자바스크립트 제이쿼리 비교, 반복문 - 별도움이 안됐음.
'이론 > jQuery' 카테고리의 다른 글
[jQuery] .hide() .show() .fadeOut() .fadeIn() (0) | 2021.10.23 |
---|---|
[jQuery] .width() .height() (0) | 2021.10.23 |
[jQuery] .filter() (0) | 2021.10.23 |
[jQuery] 선택자의 순서 값을 찾아주는 .index() 메서드 (0) | 2021.10.23 |
[jQuery] 애니메이션 .stop() .animate() (0) | 2021.10.23 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- [[Prototype]]
- 불일치 연산자
- 객체의 프로퍼티
- 일치 연산자
- 링크막기 #a링크막기
- scrollHeight
- offsetHeight
- property
- outerHeight
- 동치 연산자
- innerHeight
- 동등 연산자
- clinetTop
- 점 표기법
- 부등 연산자
- 대괄포 표기법
- 프로퍼티
- javascript class
- prototype 프로퍼티
- constructor
- @font-face
- scrollTop
- clientHeight
- __proto__
- offsetTop
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함