부모 sibbling을 선택하고 싶습니다. 그러나 Jquery는 오류가 없어도 제대로 작동하지 않습니다.Jquery select 부모 parent 형제
클릭 클래스 BLC4 디스플레이 모달 (클래스 boxmo).
HTML :
<div id="bodypro">
<div class="product pro">
<img class="product-img pro" src="imagessc/fxynxo1413781254438.jpg">
<div class="product-actions pro">
<div class="nav titlen pro" style="margin-top: 0%;">RAJFOO Gaming Mouse Button</div>
<div class="nav pro boxp" style="margin-left: 0px;">
<ul>
<li class="blc4 data-toggle= active" data-original-title="Product Page" title="" data-placement="left" tooltip"="">
</ul>
</div>
</div>
</div>
<div class="boxmo">
<div style="display: none;" aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" class="modal productmodal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button aria-hidden="true" data-dismiss="modal" class="close" type="button"><i class="text-danger fa icon-remove"></i></button>
<h4 id="myModalLabel" class="modal-title"><i class="text-muted fa fa-shopping-cart"></i>RAJFOO Custom</h4>
</div>
<div class="modal-body">
<div class="modal-footer">
<div class="text-left pull-left col-md-6">
</div>
</div>
</div>
</div>
</div>
JQUERY :
$j('.blc4').on('click', function(event) {
$j(this).parent().parent().siblings('.boxmo').find('.productmodal').modal('show');
)}
작동하지 않습니다.
당신은, 당신은 다른parent
전화를 한 단계 떨어져을 필요로하는
$j(this).parents('#bodypro').find('.productmodal.modal').modal('show');
'$ j'가 jQuery의 별칭인가요? 이 코드의 컨텍스트는 무엇입니까? '$ j (this)'는 당신이 그것을 실행하는 범위에 의존 할 것이다. 컨텍스트를 모르는 경우 코드의 문제점을 어떻게 알 수 있습니까? –
_ "내 Jquery는 오류가 없어도 제대로 작동하지 않습니다."_ 분명히 오류가 있습니다. 그렇지 않으면 작동합니다. – nnnnnn
위대한 의견, 기여 덕분에 – user3710844