Define and bind client scripts to components
Add and edit client scripts in UI Builder so that you can update the client state through events. You can bind these scripts to any component by using an event handler.
Before you begin
Role required: ui_builder_admin
About this task
You can create JavaScript client scripts in UI Builder by using the Now Code editor. Then, you can add the client script as an event handler to update the client state, emit a handled event of your page, or execute a data resource operation. For example, you could write a script to increment a date or counter, and bind the script to a component event, like a button click. For more information about the Now Code Editor, see Edit code with the Now Code Editor (advanced feature).
With these scripts, you can do the following actions:
- Get available data, manipulate the data, and store it in the client state.
- Access data resource results.
- Execute data resource operations.
- Dispatch events.