# Basic State Definition – DOM Ready State

The most basic use case for a state is the DOMContentLoaded event handle. This will create a JENTIS State in your JTM account that activates on the named web browsers event. Further details on this api and specs can be found here: [DOMContentLoaded event – Web APIs | MDN](https://developer.mozilla.org/en-US/docs/Web/API/Window/DOMContentLoaded_event)

{% code title="DOM Ready State - Javascript Function" lineNumbers="true" %}

```javascript
function(initState) {
  document.addEventListener('DOMContentLoaded', (event) => {
    initState();
  });
};
```

{% endcode %}

With this State in place, your DCP will react as soon as the event is triggered in a user's browser, activating all triggers, checking conditions, and calculating all Frontend Variable values. So, with this state, you are ready to go if this event fits your requirements.

\\


---

# Agent Instructions: 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.jentis.com/jentis-dcp-elements/states/state-registry-creating-and-managing-jentis-states/basic-state-definition-dom-ready-state.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.
