toogleclass two div one above the other

toogleclass two div one above the other

Hi All!

I'm newbie to jquery..

I have tw absolutely positioned div, one above the other.
One of two, have the class .hide {display:none}

Under the divs, there are two link that i would change the class from one div to the other, with a small fade.

The link 1 must assign the class to the  div 2,  the link 2 assign the class to the div 1.
So, the link 1 show the div 1, and the link 2 show the div 2.

I think it's easy.

I tried in this way, but don't work.

  1. $("ul>li>a.link1").click(function () {
  2. $('#div1').ToggleClass('hide') .fadeToggle('slow', 'linear');
  3. $('#div2').ToggleClass('hide') .fadeToggle('slow', 'linear');
  4. }
  5. $("ul>li>a.link2").click(function () {
  6. $('#div1').ToggleClass('hide').fadeToggle('slow', 'linear');
  7. $('#div2').ToggleClass('hide').fadeToggle('slow', 'linear');
  8. }

Where am I wrong?

Thanks to everyone who can help me!


Bye!