Click here to Skip to main content
15,889,612 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello everyone,
I am stuck with a problem. I have used this jQuery code for toggling 2 divs with a slide effect:
<script type=text/javascript>
    $(document).ready(function() {
        //hide the all of the element with class msg_body
        $(".msg_body", "litCategoryName").hide();
        //toggle the componenet with class msg_body
        $(".msg_head").click(function() {
            $(this).next(".msg_body").slideToggle(50);
        });
    });
</script>

It's working fine, but I want to display a + or - too when someone expands and collapses the 2 divs.
Can anyone guide me on how to achieve this.

Thanks in advance!
Posted
Updated 1-Apr-11 2:35am
v2

1 solution

A couple of ways I can think of

1) Add a div with the appropriate image and update the src depending on status, expanded or collapsed
2) Use append or insert to add the image to the image to the element necessary
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900