티스토리 뷰
$('선택자').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
- 동치 연산자
- offsetTop
- 동등 연산자
- 불일치 연산자
- outerHeight
- prototype 프로퍼티
- 객체의 프로퍼티
- innerHeight
- constructor
- 점 표기법
- __proto__
- 프로퍼티
- 대괄포 표기법
- property
- clinetTop
- 부등 연산자
- scrollTop
- offsetHeight
- @font-face
- javascript class
- 링크막기 #a링크막기
- 일치 연산자
- scrollHeight
- clientHeight
- [[Prototype]]
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
글 보관함