ile seçme jquery İçinde '.post-comment-reply'
iç içe geçmiş (ilk düzey değil) bulunan tüm .post-comment-replies
bulmak istiyorum.Tüm çocuk sınıflarını koşullu
Aşağıdaki kodda, içlerinde .post-comment-reply
iç içe olan .post-comment-replies
numaralı bağlantıyı da alıyorum. Burada :has()
seçici bir ya .post-comment-reply
daha soyundan sahiptir .post-comment-replies
almak için bize yardımcı olacaktır
var all_replies = $('#post_' + post_id)
.find('.post-comment-replies:has(.post-comment-reply)');
Sen :has()
seçici ile bunu yapabilir
$(document).on('click', '.open-all-post-comments', function (event) {
var post_id = $(this).data('pid');
var all_replies = $('#post_' + post_id).find('.post-comment-replies');
all_replies.show();
$(this).closest('.open-all-post-comments-row').hide();
});
Eğer _ ne demek istiyorsunuz "(ilk değil seviyesi)" _? – guest271314
Demek istediğim, derin iç içe, yani .children() 'gibi bir şey işe yaramayacaktı. –