What happens if you move your jquery source link to the top
and leave your toggle code in the bottom?

Rick

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Erik
Sent: Wednesday, December 30, 2009 7:54 AM
To: jQuery (English)
Subject: [jQuery] Toggle link Needs to Be UNDERNEATH!!!

Hi Everyone,

My script works great, but I don't know why the link has to be above
the toggle content.  Is it possible to place the link beneath the DIV
I want to hide and show.  Right the script only works if the link is
above.

My intent is to have independent DIV's that toogle...  It works, but I
need the links below the DIV.

Any suggestions?

Very grateful.

Erik



HEREE IS MY CODE:



<!DOCTYPE html>
<html dir="ltr" lang="en-CA">


<body>

<div class="SomeOtherClass">
        Foo <a class="SomeClass" href="#">More Details</a>
        <a class="SomeClass" href="#">More Details</a>
        <div class="SomeOtherClass">
                foo </div>
        <a class="SomeClass" href="#">More Details</a>
        <div class="SomeOtherClass">
                foo </div>
</div>

</body>
<script src="/src/js/jquery/core/jquery-1.3.2.min.js" type="text/
javascript"></script>
<script type="text/javascript">

$(document).ready(function()
{
        $('.SomeOtherClass').hide();
        $('a.SomeClass').click(function()
        {
                $(this).next('div.SomeOtherClass').slideToggle(400);
                $(this).text($(this).text() == 'More Details' ?
'Close' : 'More Details');
                return false;
        });
});

</script>

</html>


Reply via email to