<givenAnswer>
<givenAnswer> is a Sectional
component that renders an expandable block labelled “Answer”. It is a
sibling of <solution> and behaves the same way — the
content is hidden by default and revealed when the learner clicks the
heading — but the label says Answer rather than Solution.
Use <givenAnswer> inside a <problem> or
<exercise> when you want to provide the final answer
separately from a worked solution.
Attributes and Properties
Attributes for <givenAnswer>
Common to all components (9)
copyreference. Create an independent copy of another component by reference. Enter a references a $name.
disabledboolean. Default value: false. Whether this component is disabled and cannot be interacted with.
extendreference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.
fixedboolean. Default value: false. Whether this component's value is fixed and cannot be modified.
fixLocationboolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
hideboolean. Default value: false. Whether the solution is initially hidden.
isResponseboolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.
nametext. The name used to reference this component from elsewhere in the document.
styleNumberinteger. Default value: 1. The style number used to select this component's visual styling from the available style definitions.
Properties for <givenAnswer name="g">
Other (5)
$g.disabledboolean. Whether this component is disabled and cannot be interacted with.
$g.fixedboolean. Whether this component's value is fixed and cannot be modified.
$g.fixLocationboolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
$g.openboolean. Whether the solution is currently open (revealed).
Common to all components (4)
$g.doenetMLtext. The DoenetML source code that produced this component.
$g.hideboolean. Whether the solution is currently hidden.
$g.isResponseboolean. Whether this component is treated as a response for the purposes of assessment.
$g.styleNumberinteger. The style number used to select this component's visual styling from the available style definitions.
Examples
Example: Final answer alongside a worked solution
<givenAnswer> gives the final answer in a separate, expandable panel,
while <solution> holds the longer walkthrough.
Example: Answer-only block (no worked solution)
Use <givenAnswer> on its own when there is no separate worked
solution and you simply want a clickable “Answer” reveal.