$(".test").children().slice(0,3); // test 클래스 한 단계 하위 요소중에 첫번째에서 3개 요소 선택
$("img").slice(0,2).clone().appendTo("#gallery"); // img 전부를 선택한후 첫번째 요소부터 2개 요소를 선택해서 gallery 영역에 복사
$(".test").children().filter(".select"); // test 클래스 한 단계 하위 요소중에 select 클래스
$(".test").children().not(".select"); // test 클래스 한 단계 하위 요소중에 select 클래스만 빼고 전부

'javascript, jquery' 카테고리의 다른 글

타이머 - setTimeout  (0) 2014.10.02
찾기 - find  (0) 2014.10.02
순서 - first / eq / last  (0) 2014.10.02
바꾸기 - replaceWith  (0) 2014.10.02
요소이동 - parent / children / prev / next  (0) 2014.10.02
블로그 이미지

디츠

“말은 쉽지, 코드를 보여줘.” “Talk is cheap. Show me the code.” – 리누스 토르발스(Linus Torvalds)

,
$(".test").first();
$(".test").eq(0); // 첫번째 요소
$(".test").last();

'javascript, jquery' 카테고리의 다른 글

찾기 - find  (0) 2014.10.02
필터 - slice / filter / not  (0) 2014.10.02
바꾸기 - replaceWith  (0) 2014.10.02
요소이동 - parent / children / prev / next  (0) 2014.10.02
마우스 오버.아웃 - hover  (0) 2014.10.02
블로그 이미지

디츠

“말은 쉽지, 코드를 보여줘.” “Talk is cheap. Show me the code.” – 리누스 토르발스(Linus Torvalds)

,
$("#test").replaceWith("<h1>replace test</h1>");
블로그 이미지

디츠

“말은 쉽지, 코드를 보여줘.” “Talk is cheap. Show me the code.” – 리누스 토르발스(Linus Torvalds)

,
$("#test").parent(); // 한 단계 위로
$("#test").children(); // 한 단계 밑으로
$("#test").prev(); // 이전
$("#test").next(); //다음

$("#test").parent().parent().remove();
$("#test").parent().next().remove();
$f = $("#test").parent().parent().next(); - 변수로 지정도 가능

'javascript, jquery' 카테고리의 다른 글

순서 - first / eq / last  (0) 2014.10.02
바꾸기 - replaceWith  (0) 2014.10.02
마우스 오버.아웃 - hover  (0) 2014.10.02
클래스 추가.삭제 - addClass / removeClass  (0) 2014.10.02
이벤트 추가, 제거 - bind / unbind  (0) 2014.10.02
블로그 이미지

디츠

“말은 쉽지, 코드를 보여줘.” “Talk is cheap. Show me the code.” – 리누스 토르발스(Linus Torvalds)

,
$("#test").hover(
	function() {
		$(this).addClass("add");
		alert('add');
	}, function() {
		$(this).removeClass("remove");
		alert('remove');
	}
);
블로그 이미지

디츠

“말은 쉽지, 코드를 보여줘.” “Talk is cheap. Show me the code.” – 리누스 토르발스(Linus Torvalds)

,
$("#test").addClass("add");
$("#test").removeClass("remove");
블로그 이미지

디츠

“말은 쉽지, 코드를 보여줘.” “Talk is cheap. Show me the code.” – 리누스 토르발스(Linus Torvalds)

,