Class Adder Actions 🧪
Add, remove, or toggle a specific class on an element.
Last updated
Was this helpful?
Add, remove, or toggle a specific class on an element.
Last updated
Was this helpful?
UNDER SPECIFICATION
Problems;
Ideally we want to be able to attach multiple event-actions to a single element.
sa-action-class-data:test
Add the appropriate attribute to add, remove, or toggle classes. Assign it to the Event name that will invoke this Action.
e.g. sa-action-class-add
= ( event name )
Separately, define the class that is being manipulated;
e.g. sa-action-class-data
= ( class name )
See for more details on the class name.
These are the supported Action attributes;
sa-action-class-add
Add a class to the element
sa-action-class-remove
Remove a class from the element
sa-action-class-toggle
Toggles the class on the element
sa-action-class-data
= ( class name ) Specify the class name that will be added, removed, or toggled.
It may be possible to specify multiple classes, space-delimited, e.g. red highlight
.
In this case we would add or remove both classes.
Toggling here could be ambiguous, e.g. if the element has red
but not highlight
than what state is it in? In this scenario, we would likely consider it "off", and the initial toggle action would turn it "on" by ensuring both classes are added.
See for how to specify the class
See for how to specify the class
See for how to specify the class