One of the problems is that LI tags don't really make good candidates for
showing and hiding like you're trying.

Another problem is that in your code is that you're trying to show/hide an A
tag which is an inline tag. You'd be better off changing your code to
something like this:

<div id="scTopNavList">
    <div><a href="#divPippo">Pippo</a></div>
    <div><a href="#divPluto">Pluto</a></div>
</div>

Then working with it. You'll probably get better results.

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Massimiliano Marini
Sent: Thursday, April 26, 2007 10:06 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Show and Hide DIV


Hi all,

I'm in this situation :

<ul id="scTopNavList">
    <li><a href="#divPippo">Pippo</a></li>
    <li><a href="#divPluto">Pluto</a></li> </ul>

when I click on Pippo I show the div #divPippo e vice-versa with Pluto with
this code (I don't know if is good but it work :) ) : 

 $("a").click(function(){
        var div = ($(this).attr("href"));
        $(div).show("fast");
        return false;
  });

I want this behavior: when I click on Pippo the divPippo must appear but if
another div (example Pluto) is opened it must be closed.

In my example I've reported 2 href (pippo and pluto), but if I want to do
this with a lot of link hows can I do this? Some suggestion? Thanks.

--
Massimiliano Marini - http://www.linuxtime.it/massimilianomarini/
"It's easier to invent the future than to predict it."  -- Alan Kay



Reply via email to