2015-01-27 1 views
0

. 폴더를 클릭하면. $ (this) 폴더 바로 아래에있는 .itemholder 만

<img src="img.jpg" class="folder"/> 
<div class="itemholder"></div> 
<img src="img.jpg" class="folder"/> 
<div class="itemholder"></div> 



$('.itemholder').hide(); 
$('.folder').click(function(){ 
$(this).next('.itemholder').show(); 
}); 

왜 이가 작동하지 않습니까?

+0

Pls는이 –

+2

에 대한 코드 또는 jsfiddle을 제공하는 것은 작동하는 것 같다을 http://jsfiddle.net/ccynk8nx/2/ – pawel

+0

방법 당신이 그것을 디버깅합니까? 클릭 이벤트가 발생합니까 ??? –

답변

1

:first 또는 :eq(0) 선택기를 사용 .nextAll() 다음 첫 번째 요소 대상으로 :

$(this).nextAll('.itemholder:first').show(); 
+0

이것이 해결되었지만, 왜 내 진술이 제대로 작동하지 않았는가. –

관련 문제