Template:Checkbox

From Imagisphere
Revision as of 14:18, 7 June 2024 by Bog (talk | contribs)
Jump to navigation Jump to search

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 - Optional, text and checkbox color

check - Optional, 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.