$(document).ready(function() {
$('#foo dt').click(function() {
var show=false;
var self=this;
$(this).find('*').each(function() {
if (this.tagName.toLowerCase()=="DT") {
show = this==self;
} else if (this.tagName.toLowerCase ()=="DD") {
if (show) $(this).slideDown(); else $(this).slideUp();
}
});
});
});
if (this.tagName.toLowerCase()=="DT") {
show = this==self;
} else if (this.tagName.toLowerCase ()=="DD") {
if (show) $(this).slideDown(); else $(this).slideUp();
}
});
});
});
On 10/1/06, Jörn Zaefferer <[EMAIL PROTECTED]> wrote:
Webunity | Gilles van den Hoven schrieb:
> Use this code instead:
>
> $(document).ready(function() {
> $('#foo').find('dd').hide().end().find('dt').click(function() {
> $(this).find('dd').each(function() {
> if ($(this).is(':visible')) {
> $(this).slideUp();
> } else {
> $(this).slideDown();
> }
> });
> });
> });
>
That would only work if the dd elements were childs of the dt elements.
The sepc allows multiple definition terms followed by multiple defintion
descriptions. Without some kind of nexts('dd') that is pretty hard to
express with jQuery. Maybe someone else has an idea how to solve this.
-- Jörn
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________ jQuery mailing list [email protected] http://jquery.com/discuss/
