# set\_class

Source: https://zotonic.com/docs/2040/set_class

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

Language: en



Set the class of an element.

Example:

```erlang
<div id="x" class="not-inited"></div>
{% button text="Init" action={set_class target="x" class="inited"} %}
```

This uses the jQuery attr(‘class’, class\_name) method to set the new class.

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/2040?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/2040?language=en>)
