有人可以幫我解決這個問題嗎?當我點擊「showfaqanswer」時,我只想要顯示「faqanswer」。我沒有看到PHP和jQuery代碼有什麼問題。謝謝您的幫助!jQuery的問題nextUntil
<?php query_posts("cat=17&posts_per_page=7&offset=7"); ?>
<?php if (have_posts()) while (have_posts()) : the_post(); ?>
<p>
<a href="#" id="showfaqanswer"><?php the_title(); ?></a><br />
</p>
<div id="faqanswer"><?php the_content(); ?></div>
<?php endwhile; ?>
jQuery(document).ready(function() {
$('#showfaqanswer').click(function(){
$('#faqanswer').nextUntil('#showfaqanswer').show();
});
});
ID必須是唯一的。更改ID上課,嘗試 – Kishore