I’m having a problem with toggling certain links, if a link is clicked. I don’t know why, and I have no idea about jQuery, but somehow whenever I click on a link, it displays all of them.
This one doesn’t work at all, I’ve found another example, and an example to my what I’ve made, but seems like mine doesn’t work, and I have problems with the $(this) next, etc.
<link rel="stylesheet" type="text/css" href="css/navigation.css" />
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#nav ul li .subnav').hide();
$('#nav ul li a').click(function(){
$(this).next('#nav ul ').slideToggle('fast');
});
});
</script>
<div id="nav">
<ul>
<li><a href="#"><b>Startseite</b></a></li>
</ul>
<ul>
<li class="subnav"><a href="#"><span>Blub</span></a></li>
<li class="subnav"><a href="#"><span>Blub</span></a></li>
<li class="subnav"><a href="#"><span>Blub</span></a></li>
<li class="subnav"><a href="#"><span>Blub</span></a></li>
</ul>
</div>