My code
$('.viewreplycommentbutton').click(function() {
$(this).next('.reply').slideToggle(200);
});
I have three <div>
s with the class .reply
and when i click on a button with a link (which has the class .viewreplycommentbutton
) it will show only one of those three <div>
i want to view all of these when i click on the button (which is a link with the class .viewreplycommentbutton
) but without removing $(this)
from the jQuery code.
.next()
returns next immediate sibling element. Use .nextAll()
to get next all siblings:
$('.viewreplycommentbutton').click(function() {
$(this).nextAll('.reply').slideToggle(200);
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.