I'm making a family tree. The following script allows the user to expand branches of the tree. It works fine, but there must be a better way.
You can see it working here.
$(function(){
$('.oc').prepend('<img src="icons/bullet_add.png" alt="more" width="16" height="16"/>')
$("ul[id|=Nested]").hide();
$("a[id|=trigger_Nested]").click(function() {
var text = $(this).siblings("ul");
if (text.is(':hidden')) {
text.slideDown("fast");
$(this).next("span").html('<img src="icons/bullet_take.png" alt="close" width="16" height="16" />');
} else {
text.slideUp("fast");
$(this).next("span").html('<img src="icons/bullet_add.png" alt="more" width="16" height="16" />');
}
return false;
});
});