2011-07-02 5 views
0

다음 문제를 해결하고 있습니다 - DB 테이블의 항목에 대한 내 페이지 문에이 항목이 div로 인쇄됩니다. 사용자가이 div에서 마우스 커서를 움직이면 다른 정보와 함께 div가 표시됩니다.jQuery - "this"요소와 "parent (s)"

  <div class="dost"> 
       3 days | 
       <span>deliv</span> 
       <div class="deliv_bubble"> 
        <div><strong>aaa</strong></div> 
             <div><strong>bbb</strong></div> 
             <div><strong>ccc</strong></div> 
       </div> 
      </div> 

$('div.dost span').mouseover(function() { 
    $('div.dost div.deliv_bubble').show(); 
}); 

이 html 구조가 100 번 인쇄되었습니다. 내 문제는 내가 텍스트 deliv 에 마우스 커서를 이동할 때 deliv_bubble이 보여됩니다 사업부 그래서이지만, 불행하게도 100 배 ... 난 ...이 한 시간을 표시하려고

누군가 저를 도와 줄 수 있습니까, 제발, 내가 뭘 잘못하고있는 걸까요? 는

답변

1

이렇게 감사합니다

$('div.dost span').mouseover(function() { 
    $(this).parent().find('div.deliv_bubble').show(); 
}); 

$(this).parent()이 해당 부모에게이 도움이 div.dost

희망을 반환합니다. 건배

+0

'에드거'감사합니다. – user1946705

+0

당신은 환영합니다 :) –

1

이 시도 :

$('div.dost span').mouseover(function() { 
    $(this).siblings('div.deliv_bubble').show(); 
}); 
1
$('div.dost span').mouseover(function() { 
    $(this).siblings('.deliv_bubble').show(); 
}); 

가 수행해야합니다.

관련 문제