Name
toggle
Synopsis
This action works with a
switch element,
selecting by IDREF a particular
case within. The selected
case is rendered, while all other
cases are not. The ability to show and hide
sections is a handy way to implement a “multiple
page” form, which guides the user through one
section at a time. It’s also useful within a page,
to set up wizard-like sequences, or just to hide entire sections of
the form that aren’t needed at the moment.
Each case contains a selected
attribute, which stays in sync, so that at any given time one and
only one of the cases in a
switch will have
selected="true“. In fact, in systems that support
CSS2 selectors, one possible implementation is with the rule
case[selected="false"] { display: none }.
The toggle action is used like this:
<toggle case="summary" ev:event="DOMActivate"/>
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access