我有一个常见问题解答页(纯HTML)。这些问题具有CSS类.pagesubtitle,答案有两个类:.p1和.p2。示例是:
<p class="pageSubtitle">Which Award should I apply for?</p>
<p class="p1">Centers that wish to be recognized for adhering to Guidelines and their Quality Programs and their Processes should apply for <span style="font-weight: bold;">The Center of Excellence in Life Support Award.</span>
These programs must meet or exceed criteria in the following categories:
</p>
<p class="p2">o Systems Focus</p>
<p class="p2">o Environmental Focus</p>
<p class="p2">o Workforce Focus</p>
<p class="p2">o Knowledge Management</p>
<p class="p2">o Quality Focus</p>
<p class="p2">o Process Optimization</p>
<p class="p2">o Family Focus</p>
在此常见问题解答页面上,用户希望答案崩溃了,当您单击一个问题时,答案在其下出现。我怎样才能做到这一点?预先感谢您的任何帮助。
我终于找到了正常工作的解决方案:
<script type="text/javascript">
$(document).ready(function(){
$('.p1, .p2, .p3, .p4').hide();
$('.pageSubtitle').click(function(){
$(this).nextUntil('.pageSubtitle').toggle();
});
}); </script>