I'm having some trouble with next() and after reading through the
posts I don't think it's similar to what has already been posted.

The ideal behavior that I'd like is for the <p> (which is hidden at
first) to be shown when the anchor tag above it is clicked. There is
some extra behavior also through toggle, which adds a class on the
first click, and removes on second click.

Any help would be appreciated-- here's my script:

<script type="text/javascript">
        $(document).ready(function() {
                $("a.closed").toggle(
                        function() {
                                $(this).addClass("open");
                                $(this).removeClass("closed");
                                $(this).next("p.none").toggle("slow");
                                },
                        function() {
                                $(this).addClass("closed");
                                $(this).removeClass("open");
                                $(this).next("p.none").toggle("slow");
                                }
                        );
        });
</script>

and my HTML

<!-- Start Initial Hidden Fields -->
                                        <div class="detail-content">
                                                <h3><a href="#" 
class="closed">Solution description</a></h3>
                                                <p class="none">Lorem ipsum 
dolor sit amet, consectetuer
adipiscing elit. Morbi ante. Duis vitae elit. Etiam bibendum tempor
odio. Suspendisse enim arcu, sagittis eget, sollicitudin vel, dapibus
eu, magna. Aenean ullamcorper pede semper lacus. Donec.</p>
                                        </div><!-- end content piece -->

Reply via email to