If you want to only do something to elements that are selected as in this case (here we want to do something if the checkbox is checked) you can simplify the code to

$('#edit-checkbox-id:checked'),each(
  function() {
   // Insert code here
  }
);

and the function will only run if the checkbox with the selected id is checked.


If you use a selector that can return more than one element, the function is applied each of the matching elements (one at a time), so

$("input[@type=checkbox][@checked]").each(
  function() {
   // Insert code here
  }
);

will run the function for each checkbox that is checked.


1개의 상품이 있습니다.



전체선택 장바구니에 담기
다 빈치 코드 2
댄 브라운 지음, 양선아 옮김 / 북스캔(대교북스캔) / 2004년 7월
7,800원 → 7,020원(10%할인) / 마일리지 390원(5% 적립)
2010년 03월 30일에 저장
절판


전체선택 장바구니에 담기

1개의 상품이 있습니다.

댓글(0) 먼댓글(0) 좋아요(0)
좋아요
공유하기 북마크하기찜하기