user547794
user547794

Reputation: 14511

jQuery Slidetoggle - force div open if closed?

I am using jQuery slideToggle to show/hide comments. I need my function to always make sure the DIV is open after a comment post. How do I do this?

$.ajax({
            type: "POST",
            data: "trackid="+trackid,
            url: "http://rt.jaxna.com/viewcomments.php",
            success: function(data)
                {   
                //  alert(data);
                     $(".userError").append(data);

                }
            });
            $(parent).slideToggle();
            $(parentNew).slideToggle();

Upvotes: 0

Views: 3111

Answers (1)

SeanCannon
SeanCannon

Reputation: 77956

add

if($('#my_div').is(':hidden'))
{
    $('#my_div').slideDown();
}

Upvotes: 4

Related Questions