---
title: "DocumentService (jQuery.ready substitute)"
manual: "TYPO3 Explained"
version: "11.5"
permalink: "https://docs.typo3.org/permalink/t3coreapi:modules-documentservice@11.5"
source: "ApiOverview/JavaScript/Modules/DocumentService.rst"
rendered: "2026-10-21T15:30:00+00:00"
---

> [!WARNING]
> **Attention**
>
> TYPO3 v11 has reached end-of-life as of October 31th 2024 and
> is no longer being maintained. Use the version switcher on the top
> left of this page to select documentation for a supported version of TYPO3.
>
> Need more time before upgrading?
> You can purchase Extended Long Term Support (ELTS) for TYPO3 v11 here:
> [TYPO3 ELTS](https://typo3.com/services/extended-support-elts).

# DocumentService (jQuery.ready substitute) {#modules-documentservice}

The module `TYPO3/CMS/Core/DocumentService` provides native JavaScript
functions to detect DOM ready-state returning a `Promise<Document>`.

Internally the Promise is resolved when native `DOMContentLoaded` event has
been emitted or when `document.readyState` is defined already. It means
the initial HTML document has been completely loaded and parsed, without
waiting for stylesheets, images, and sub-frames to finish loading.

```javascript
$(document).ready(() => {
  // your application code
});
```

Above jQuery code can be transformed into the following using `DocumentService`:

```javascript
require(['TYPO3/CMS/Core/DocumentService'], function (DocumentService) {
  DocumentService.ready().then(() => {
    // your application code
  });
});
```
