SlideToggle

SlideToggle

Hello, i am newbie to j Query and i have problem regarding my project.

I have li elements created by php and with each li element i get div layout showing some data.

I would like to be able to click to title located in li and be able to show div layout and hide everything else but when i click again on title it hides layout div and show all of list again.

Here is structure:

  1. <ul>
  2. <li><a href="#" class="click">Title dynamically 1</a></li>
  3. <div class="layout">Data dynamically 1</div>
  4. <li><a href="#" class="click">Title dynamically 2</a></li>
  5. <div class="layout">Data dynamically 2</div>
  6. </ul>
My jQuery code:

  1. $('li a').click(function () {
  2.   $('li a').next('.layout').slideToggle(600);
  3.        $('li a').not(this).slideToggle(600);

With this code it only hides title and doesn't show layout

I have tried lot of combinations but no luck, can anybody help me with this?