> For the complete documentation index, see [llms.txt](https://docs.wem.io/platform/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wem.io/platform/template-editor/miscellaneous/script.md).

# Script

## ![](/files/tz81YfBcK2VAVpiF1zrt) Introduction

{% hint style="info" %}
You can find more information about the WEMScript in the specific pages. There is a page about the [WEMScript for Custom HTML](/platform/wemreference/wemscript-for-custom-html.md), and [WEMScript for Widgets](/platform/wemreference/wem-widgets/wemscript-for-widgets.md).
{% endhint %}

With the Script widget you can add HTML code and other script code (like JavaScript) to the Template Editor.

**Note**: when you use the Script widget, it is possible to overwrite (intended or unintended) the Design Template settings.

Drag and drop the Script widget to the Template Editor and the box below appears.

![You can enter your HTML script here](/files/dK2KemsYTWR6nf4dkY3K)

## Illustration&#x20;

Let's build upon the EMS use case from where we had left at in the page for 'Nested Templates'. We had built an interaction template with a Tabbar consisting of two tabs and Datagrids inside Conditionals that should be displayed based on the tab clicked. The 'Projects' tab at run-time was something like the below.&#x20;

<figure><img src="/files/hSBzZ6YWoxE5lHvszjf0" alt=""><figcaption></figcaption></figure>

Let's say that we now have this requirement - the total number of projects should be shown below the table, in red font.&#x20;

1. Open the 'Projects' Template Fragement.&#x20;

   <figure><img src="/files/79m141PTrcKPggp0dBeb" alt=""><figcaption></figcaption></figure>
2. Insert a Label below the Table, which would show a count of the number of projects.&#x20;

   <figure><img src="/files/71PRQDMi79gtyKtbdEkP" alt=""><figcaption></figcaption></figure>
3. Click and drag the 'Script' icon and place it above the Label.&#x20;

   <figure><img src="/files/VUeSPC6gWWTbHqkRC9Y0" alt=""><figcaption></figcaption></figure>
4. Compose your Script and then click on 'Validate'.

   <figure><img src="/files/lZFUyadMzWmcxnsvzN4S" alt=""><figcaption></figcaption></figure>
5. Repeat steps 3 and 4 for closing the script, but below the Label.&#x20;

   <figure><img src="/files/3oDUH6o80fb1yPudx3wu" alt=""><figcaption></figcaption></figure>
6. Click on 'Save' in the Template Editor. When you preview, you will now see the Label in red below the Table.&#x20;

   <figure><img src="/files/QrgLW7Y3ZNkFqB3PVjAN" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wem.io/platform/template-editor/miscellaneous/script.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
