div要素がクリックされたときに表示したいテキストが非表示になっているページにいくつかのdivがあります。divのクラスを使用してこれを行うにはどうすればよいですか?
これが私のhtmlです:
<div id="post-<?php the_ID(); ?>" <?php post_class('team-member'); ?>>
<?php echo get_the_post_thumbnail($page->ID, array(441,293)); ?>
<div class="bio-button">BIO</div>
<h2><?php the_title(); ?></h2>
<h3><?php the_excerpt(); ?></h3>
<div class="team-text">
<p><?php the_content(); ?></p>
</div>
</div>
そして私のjquery:
$('.bio-button').toggle(function () {
$('.team-text',this).show();
}, function () {
$('.team-text',this).hide();
return false;
});
繰り返しますが、.team-member 用に複数の div を作成します。.team-text は非表示になり、.bio-button をクリックすると表示されます。
jqueryで何が間違っていますか?