Пример HTML-разметки нижеJQuery выберите Родитель проблема
<div class="container answer_comments">
<p class="comment_text">Hey that's not cool.</p>
<p class="comment_attribs">By Anonymous User on 01 Dec</p>
<p class="comment_text">Is that really why?</p>
<p class="comment_attribs">By person on 27 Nov</p>
<p class="close_comments" onclick="close_comments()">Close</p>
</div>
функции JS:
function close_comments() {
var comments_wrapper = $(this).closest('.answer_comments');
comments_wrapper.slideUp();
}
.answer_comments не будет закрыта. заключается в том, что из-за неправильного использования $ (this)? Этот div повторяется много раз на странице, что было бы лучшим способом добиться того, что я пытаюсь сделать?
, что работает, большое спасибо. – stef