2013-05-07 39 views
0

我想選擇以下功能的元素選擇元素:

$('.reply-comment').live('click', function(){ 
if($(this).parents('.element_footer').find('.reply, .send-reply').is(':hidden')){ 
    $(this).parents('.element_footer').find('.reply, .send-reply').slideDown('fast'); 
}else if($(this).parents('.element_footer').find('.reply, .send-reply').is(':visible')){ 
    $(this).parents('.element_footer').find('.reply, .send-reply').slideUp('fast'); 
} 
return false; 

});

後:.find('.reply, .send-reply').slideDown('fast')我會鏈接一個.focus()只是.reply元素

如何從$(this)選擇它?

回答

2

使用.filter()

描述:減少匹配的元素的那些選擇器匹配或傳遞函數的測試。

$(this).filter('.reply'); 
+0

謝謝!這工作正常! – 2013-05-07 12:32:32