2013-05-07 37 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