[jQuery] problem with a vertical accordian menu
[jQuery] problem with a vertical accordian menu
Hello,
I have this html file for a menu
<dl id="menu">
<dt>
<a href="#">Weblog Tools</a>
<dd><a href="
http://www.pivotx.net/">PivotX</a></dd>
<dd><a href="
http://www.wordpress.org/">WordPress</a></dd>
<dd><a href="
http://www.textpattern.com/">Textpattern</a></dd>
<dd><a href="
http://typosphere.org/">Typo</a></dd>
</dt>
<dt><a href="#">Programming Languages</a>
<dd><a href="
http://www.php.net/">PHP</a></dd>
<dd><a href="
http://www.ruby-lang.org/en/">Ruby</a></dd>
<dd><a href="
http://www.python.org/">Python</a></dd>
<dd><a href="
http://www.perl.org/">PERL</a></dd>
<dd><a href="
http://java.sun.com/">Java</a></dd>
<dd><a href="
http://en.wikipedia.org/wiki/C_Sharp">C#</a></dd>
</ul>
</dt>
</dl>
i changed my menu.js to this :
function initMenu() {
$('#menu dl').hide();
$('#menu dl:first').show();
$('#menu dt a').click(
function() {
var checkElement = $(this).next();
if((checkElement.is('dt')) && (checkElement.is(':visible'))) {
return false;
}
if((checkElement.is('dt')) && (!checkElement.is(':visible'))) {
$('#menu dt:visible').slideUp('normal');
checkElement.slideDown('normal');
return false;
}
}
);
}
$(document).ready(function() {initMenu();});
But now nothings happens.
What went wrong here ?
Roelof