Template:FAQItem
Creates a FAQ item with collapsible details and a permalink
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Question | question | The Question | String | required |
| Answer | answer | The Answer to the question | String | required |
FAQItem usage
- Copy text between the horizontal lines for each Question with Answer
- Put the Question after | question =
- Put the Answer after | answer =
{{FAQItem
| question =
| answer =
}}
The FAQItem will render as it appears below this line.
<details class="faq-item">
<summary style="font-weight: bold; font-size:larger;"> {{{question}}} </summary>
<a href="#" class="copy-link" data-frag="{{{question}}}">
Copy link to this question
</a>
{{{answer}}}
</details>
<script> document.addEventListener('DOMContentLoaded', function() {
document.querySelectorAll('.copy-link').forEach(function(link) {
link.addEventListener('click', function(e) {
e.preventDefault();
const frag = this.getAttribute('data-frag');
const url = window.location.origin + window.location.pathname + '#' + frag;
navigator.clipboard.writeText(url).then(() => {
const original = this.innerText;
this.innerText = 'Copied!';
setTimeout(() => { this.innerText = original; }, 1500);
});
});
});
}); </script>