HTML:
<div class="interview">
<h4>Interview</h4>
<a href="#" class="question">This is question 1?</a>
<div class="answer">This is an answer!</div>
<a href="#" class="question">This is question 2?</a>
<div class="answer">This is an answer!</div>
<a href="#" class="question">This is question 3?</a>
<div class="answer">This is an answer!</div>
</div>
jQuery:
if ($('interview')[0]) {
$('interview .question').toggle(function () {
$(this).next('.answer').slideIn();
},
function () {
$(this).next('.answer').slideOut();
});
}
...我无法弄清楚为什么它不起作用。