submenu hide/show

submenu hide/show

Hello,

i have a page using submenus


when i move over "testlink 0 " a submenu is opened. When i leave the submenu it shold closed

i now have a hacked solution:) See Code below. But now its opens only on click and close on  click on submenu. And the other  problem ist, i must programm for every submenu this code.  Can someone help me to find a better solution?

thank you



  1. $("#menu ul li ul a").click(function () {
  2. $(".submenu1").css("display","none");
  3. });
  4. $(".subclick1").click(function () {
  5. $(".submenu1").css("display","block");
  6. });