LI 내부의 링크에 클래스가 있는지 알아 내려고합니다. 어떻게해야합니까? 여기에 지금까지 무엇을하려고했는데 것 : jQuery : li 내 하이퍼 링크 클래스 가져 오기
이<a class="filtergallery" id="p" href="#">Portraits</a> <a class="filtergallery" id="n" href="#">Newborn</a> <a class="filtergallery" id="pe" href="#">Pets</a>
<ul class="portfolio-wrap">
<li><a class="p" href="#" title="First Pic"><img src="#" alt="First Pic" /></a></li>
<li><a class="pe" href="#" title="Second Pic"><img src="#" alt="Second Pic" /></a></li>
<li><a class="n" href="#" title="Third Pic"><img src="#" alt="Third Pic" /></a></li>
<li><a class="pe" href="#" title="Fourth Pic"><img src="#" alt="Fourth Pic" /></a></li>
jQuery를 (특정 리튬의 숨기려) :
$('.filtergallery').click(function(event){
var theid = $(this).attr('id');
$('.portfolio-wrap li').each(function(){
if (!hasClass(theid)) { // I need to see if the hyperlink inside the LI has this class...?
hide();
}
});
})