jQuery toggle div and text

Posted by Jack on Stack Overflow See other posts from Stack Overflow or by Jack
Published on 2012-06-12T21:57:28Z Indexed on 2012/06/12 22:40 UTC
Read the original article Hit count: 197

Filed under:
|
|

I would like some help with this code, I have read similar questions & answers here on stackoverflow but I still can't get it right.

I have a link that populated by .html("") to read more…

when clicked it opens the hidden div and at the end the .html("") reads less.

When I click close the div slides closed but the text still reads less…

I have read many articles on how to do this but am confused and can't get past this last hurdle, any help would be much appreciated.

// this is the intro div

Ligula suspendisse nulla pretium, rhoncus tempor placerat fermentum, enim integer ad vestibulum volutpat. Nisl rhoncus turpis est, vel elit, congue wisi enim nunc ultricies sit, magna tincidunt. Maecenas aliquam maecenas ligula nostra, accumsan taciti.

// this next div is hidden

Ligula suspendisse nulla pretium, rhoncus tempor placerat fermentum, enim integer ad vestibulum volutpat. Nisl rhoncus turpis est, vel elit, congue wisi enim nunc ultricies sit, magna tincidunt. Maecenas aliquam maecenas ligula nostra, accumsan taciti.

$(document).ready(function() {
    $(".overview-continued").hide();
    $(".show-overview").html("more...");
    $(".show-overview").click(function() {
        $(".overview-continued").slideToggle("1000");
        $(".show-overview").html("less...");
        return false;
    });
});?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-selectors