Try using toggle instead:

${"a.welcomenav").toggle(function(){
        $("#welcome").show();
        return false;
},function(){
        $("#welcome").hide();
        return false;
}); 

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of KetanMV
Sent: Friday, April 17, 2009 11:36 AM
To: jQuery (English)
Subject: [jQuery] Newbie Question - Show/Hide on a:link


Hi guys -- very basic question here I think. I've got some documentation and
a book in front of me, but I can't get this to work!
I want to click the "Welcome" nav item to show the div named "welcome"
on the page. If I use just the "hide" line of code, the page loads up with
the DIV hidden properly. But, once I add the click/show code -- nothing
happens, including the hide onLoad. Thoughts? Thanks so much!

$(document).ready(function() {
        $("#welcome").hide();
        ${"a.welcomenav").click(function() {
                $("#welcome").show();
                return false;
        });
});

<ul id="sliding-navigation">
    <li class="sliding-element"><a href="#"
class="welcomenav">Welcome</a></li>
</ul>


Reply via email to