# script

Source: https://zotonic.com/docs/1800/script

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

Language: en



This action executes JavaScript directly. It can be used to interface with non-Zotonic JavaScript libraries and functions.

Example:

```erlang
{% button text="hello" action={script script="alert('hello world')"} %}
```

Clicking on the button will show a JavaScript alert with the text hello world in it.

Using template variables:

```erlang
{% with "world" as recipient %}
    {% button
        text="hello"
        action={
            script
            script="alert('hello " ++ recipient ++ "')"
        }
    %}
{% endwith %}
```

License: 

Attribution: 

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