mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-23 06:27:57 +00:00
35 lines
2.2 KiB
Markdown
35 lines
2.2 KiB
Markdown
---
|
||
id: run-js
|
||
title: Run JavaScript code
|
||
---
|
||
|
||
The **Run JavaScript code** query in ToolJet enables users to write and execute custom JavaScript code within their applications. It provides a flexible way to add custom logic and interact with various components. Whether it’s transforming data, manipulating component properties, or performing actions based on certain conditions, Run JavaScript code significantly enhances the capabilities of your ToolJet applications.
|
||
|
||
<div class="video-container">
|
||
<iframe width="560" height="315" src="https://www.youtube.com/embed/ySlDSuulHn8?si=0PLsANxkdwzIySIf&rel=0" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||
</div>
|
||
|
||
<div style={{paddingTop:'24px', paddingBottom:'24px'}}>
|
||
|
||
## Interacting with Components and Actions
|
||
The JavaScript code you write can interact with various components of the ToolJet application. For example, you could attach an event handler to a button so that when it's clicked, it triggers Run Javascript code to run. Additionally, you can construct the JavaScript code to manipulate the properties of other components. This allows for dynamic interactions within your application.
|
||
|
||
<div style={{textAlign: 'center'}}>
|
||
<img className="screenshot-full" src="/img/tooljet-concepts/run-js/run-js-preview.png" alt="Preview Of Run JS" />
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div style={{paddingTop:'24px', paddingBottom:'24px'}}>
|
||
|
||
## Advanced Features and Libraries
|
||
Run JavaScript code also supports advanced functionalities such as setting and unsetting variables, showing or closing modals, copying content to the clipboard, and even logging out users. This is done by using specific syntax and functions. Moreover, you can utilize libraries like Moment, Lodash, and Axios for more complex operations.
|
||
|
||
</div>
|
||
|
||
To learn more about Run JavaScript code, go through the below list of documents:
|
||
|
||
- **[Use Axios in RunJS](/docs/how-to/use-axios-in-runjs/)**
|
||
- **[Run Actions From RunJS](/docs/how-to/run-actions-from-runjs/)**
|
||
- **[Import External Libraries Using RunJS](/docs/how-to/import-external-libraries-using-runjs/)**
|
||
- **[Access a User's Location Using RunJS](/docs/how-to/access-users-location/)**
|