I'm having an issue with a hidden container that holds comments. Inside the container, there is a <div>
element with a <p>
tag that says "Show all comments". When I click on this element, it successfully displays the comments. However, clicking on it again does not hide the comments container. I suspect that there might be an error in my jQuery code. Can you help me figure out what's wrong?
var commentsHidden = $( ".comments-container" ).is( ":hidden" );
if (commentsHidden) {
$( ".see-all" ).click(function() {
$('.comments-container').show('slow');
$('.see_hide').text('Hide Comments');
});
} else {
$( ".see-all" ).click(function() {
$('.comments-container').hide();
});
};