jquery를 이용해서 index 값 알아내기

 

<div class="checkbox">
 <label>
   <input type="checkbox"> 1. okkks.tistory.com
 </label>
 <label>
   <input type="checkbox"> 2. okkks.tistory.com
 </label>
 <label>
   <input type="checkbox"> 3. okkks.tistory.com
 </label>
</div>

<script type="text/javascript">
$('.checkbox input').click(function() {
 alert($('.checkbox input').index(this)); // index 값 알아내기
});
</script> 

 


 

더보기>

- jquery css 변경 - 선택한 메뉴를 활성화하고 나머지 메뉴는 비활성화하기

Posted by 은둔고수