I'm in the process of setting up a FAQ page where answers can be toggled for display.
Here is the step-by-step guide on how to achieve it:
$(document).ready(function () {
$('.faqlink').click(function () {
$('.hiddenFAQ').hide();
$(this).next('.hiddenFAQ').toggle();
});
});
This is the CSS snippet required:
.hiddenFAQ {
display:none;
}
Finally, incorporate this HTML code into your page:
<a class="faqlink" href="#">Link 1</a>
<div class="hiddenFAQ"><p>lorem ipsum</p></div>
If you are facing difficulty with hiding the answer post-display without refreshing the page, you can implement the toggle function instead. Hope this helps! Thank you.