i've a dinamic menu <ul> <li><a id="001" href="#">001</a></li> <li><a id="002" href="#">001</a></li> <li><a id="003" href="#">001</a></li> </ul>
this menu <ul> is dynamic, ie, is automatically generated from a database, therefore I will not know many elements i'll have in the future or what identifiers they have. Moreover, i have some <p>, one for each <a> in the <ul> <p id="001"></p> <p id="002"></p> <p id="003"></p> If somebody do click in <a id=001> all <p> must be hide, but the <p id=001> must be show i've writed this code in jquery for the case "001" and is run perfect, but a need do it general for all <a> but without those elements will have a priori <script type="text/javascript"> $(document).ready(function (){ $("#content p").toggle(); $("#menu ul li a#001").click ( function showhide() { $("#content p#001").toggle("slow"); } ) } ) </script> understand me? thanks in advance