# toggle\_class

Source: https://zotonic.com/docs/1525/toggle_class

URI: https://zotonic.com/id/1525

Language: en



Toggle a CSS class from an HTML element.

Example:

```django
{% button action={toggle_class target="myid" class="newclass"} %}
```

When the HTML element with id “myid” has the CSS class “newclass” then it is removed, otherwise it is added.

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/1525?language=en


## API access

- [API help](<https://zotonic.com/api-help>)
- [OpenAPI specification](<https://zotonic.com/openapi.json>)
- [This resource as JSON](<https://zotonic.com/api/agent/resource/1525?language=en>)
