toglle and update text multiple - v2
by ian_smithz
HTML
<span class="help_target">Open</span>
<div class="help_content">Content 1</div>
<span class="help_target">Open</span>
<div class="help_content">Content 2</div>
CSS
.help_target {
display: block;
margin: 10px
}
.help_content {
margin: 20px;
background: #CCC
}
JavaScript
$(".help_content").hide();
$(".help_target").click(function() {
$(this).next('.help_content').toggle();
$(this).text($(this).text() == 'Close' ? 'Open' : 'Close');
});