> For the complete documentation index, see [llms.txt](https://docs.agilecase.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.agilecase.com/developer-documentation/custom-form-scripting/changing-colours-in-a-dropdown-menu.md).

# Changing Colours in a Dropdown Menu

This example will show you how to format the colour of a dropdown menu using a JavaScript label.

### Script

#### **Changing colours**

```javascript
// The first line of code specifies the field you want to apply the colour changes to
var fieldid = 6400
var fieldnode = $('#CustomField_'+fieldid)
// The section below implements which colour should be displayed when each option on the dropdown is chosen
switch (fieldnode.val()) {
            case ('Low'):
//The colour you want to use can be changed by simply editing the text to your colour of choice
                fieldnode.css('background-color','green');
                break;
            case ('Medium'):
                fieldnode.css('background-color','orange');
                break;
            case ('High'):
                fieldnode.css('background-color','red');
                break;
        }
```

### High risk

<figure><img src="/files/1hUm89QPXLBcqnWvMZbD" alt=""><figcaption></figcaption></figure>

This screenshot shows the dropdown field when the "High" option is selected.

### Medium risk

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

This screenshot shows the field when the "Medium" option is selected.

### Low risk

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

The final screenshot shows the field when the "Low" option is selected.


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.agilecase.com/developer-documentation/custom-form-scripting/changing-colours-in-a-dropdown-menu.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
