need help (beginner)

need help (beginner)

Hello!

I'm learning jQuery now. The following example has no effect:
  1.     $(document).ready(function() {
  2.               $("#cat1 ul").hide();

  3.               $("#cat1 li:has(ul)").each(function() {
  4.                 $(this).children().slideUp(400);
  5.               });

  6.               $("li:has(ul)").click(function(event){
  7.                 if (this == event.target) {
  8.                   var current = this;
  9.                   $("#cat1 li:has(ul)").each(function() {
  10.                     if (this != current) $(this).children().slideUp(400);
  11.                   });
  12.                   $("ul:first", $(this)).slideToggle(400);
  13.                 }
  14.               });
  15.     });
If the a list contains a text (e.g. Example 2) wrapped in <a> than the text disappears. Without <a> params the code is working. How can a link excluded from hiding? Which selector is needed?
  1.           <ul id="cat1">
  2.             <li>
  3.               Example 1
  4.               <ul>
  5.                 <li>
  6.                   <ahref="#">Item 1</a>
  7.                 </li>
  8.                 <li>
  9.                   <a href="#">Item 2</a>
  10.                 </li>
  11.                 <li>
  12.                   <a href="#">Item 3</a>
  13.                 </li>
  14.                 <li>
  15.                   <a href="#">Item 4</a>
  16.                 </li>
  17.                 <li>
  18.                   <a href="#">Item 5</a>
  19.                 </li>
  20.               </ul>
  21.             </li>
  22.             <li>
  23.               <a href="#">Example 2</a>
  24.               <ul>
  25.                 <li>
  26.                   <a href="#">Item 6</a>
  27.                 </li>
  28.                 <li>
  29.                   <a href="#">Item 7</a>
  30.                 </li>
  31.                 <li>
  32.                   <a href="#">Item 8</a>
  33.                 </li>
  34.                 <li>
  35.                   <a href="#">Item 9</a>
  36.                 </li>
  37.               </ul>
  38.             </li>
  39.             <li>
  40.               Example 3
  41.             </li>
  42.           </ul>
Can someone give me a hint?

Thanks, Daremes