i have an ul with some li something like this
<?php
for($i=0; $i<5; i++) {
$id_name = "link" . $i;
echo "<ul><a href='#' id=$id_name >list</a>
<li class='on'>1</li>
<li class='on'>2</li>
<li class='on'>3</li>
</ul> ";
}
?>
and css :
.off{display:none;} .on{display:block;}
I want every time I click a link to hide all li elements of this link. I tried jQuery with toggleClass() function but I can't do nothing is I don't know the id of the link. I read something about child() and parent() functions. Can I use this way? (sorry for the programming mistakes i am new to php)
<ul>tags are<li>tags ... I'd fix the HTML first then work on the JavaScript (as the structure will be different)...