I am trying to create a toggle button with .details
. On first load, it should just display as "Display [+]" with .details-display
hidden. When the text is clicked, it should change to "Display [-]" with .details-display
slid down. Why isn't this working?
HTML
<div class="slide-caption">
<span class="details">Details[+]</span>
<span class="details-display">The connecting walkway floats above the second story of the Main hall, joining the North and the South wings.</span>
</div>
JS
$('span.details').toggle(function(){
$(this).html('Details[-]');
$(this).parent().find("span.details-display").slideDown("slow");
}, function() {
$(this).html('Details[+]');
$(this).parent().find("span.details-display").slideUp("slow");
});
CSS
.details-display {
display: none;
}