Template:Checkbox: Difference between revisions
No edit summary |
mNo edit summary |
||
Line 35: | Line 35: | ||
<code>hideYes=class1,class2,class3</code> | <code>hideYes=class1,class2,class3</code> | ||
'''Note:''' you should put these class names on a separate span that goes over your elements, because the checkbox changes the <code>style="display:*"</code> attribute and will overwrite if the span already has an existing display attribute. | '''Note:''' you should put these class names on a separate <code><<nowiki/>span></code> that goes over your elements, because the checkbox changes the <code>style="display:*"</code> attribute and will overwrite if the span already has an existing display attribute. | ||
</noinclude> | </noinclude> |
Revision as of 14:16, 7 June 2024
Checkboxes can be used to hide & show different elements.
Usage
{{checkbox|color=black|check=Yes|title=Title1|id=cb1|hideYes=|hideNo=|showYes=|showNo=}} {{checkbox|color=black|check=No|title=Title2|id=cb2|hideYes=|hideNo=|showYes=|showNo=}} {{checkbox|color=white|check=Yes|title=Title3|id=cb3|hideYes=|hideNo=|showYes=|showNo=}} {{checkbox|color=white|check=No|title=Title4|id=cb4|hideYes=|hideNo=|showYes=|showNo=}}
color - Text and checkbox color
check - If it's checked by default (yes/no)
title - Optional text next to checkbox
id - Optional, needed when more than one checkboxes are present. Each needs a unique id.
The following are optional, use a list of classes to show/hide with the respective conditions:
hideYes - hide when checked
hideNo - hide when unchecked
showYes - show when checked
showNo - show when unchecked
This is the syntax for the list of class names of the elements you want to show/hide, each class name needs to be separated by a comma like this:
hideYes=class1,class2,class3
Note: you should put these class names on a separate <span>
that goes over your elements, because the checkbox changes the style="display:*"
attribute and will overwrite if the span already has an existing display attribute.