---
title: "Unable to include JS file in Extension"
url: "https://www.typo3.net/d/127306-unable-to-include-js-file-in-extension"
source: "typo3.net"
tags: ["Extensions","Extbase","English","Fluid","Frage","JavaScript & AJAX"]
created: "2019-01-17"
last_reply: "2019-01-18"
replies: 2
solved: false
page: 1
pages: 1
lang: "en"
---

# Unable to include JS file in Extension

Extensions › Extbase · 2 Antworten · gestartet 2019-01-17

## Eröffnungsbeitrag

**Meghna** · 2019-01-17 · [Beitrag #1](https://www.typo3.net/d/127306-unable-to-include-js-file-in-extension/1)

Hi Experts,

I am new to TYPO3, I want to include bootstrap datetimepicker in my extension. Below is my code:

List.html

<head>
        <script src="jhttps://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js">
        </script>
        <script src="jquery.datetimepicker.full.js"></script>
        <script src="{f:uri.resource(path:'JS/datetimepicker.full.js')}"></script>
        <script>$("#datetimepicker").datetimepicker();</script>
    </head>
    <f:section name="content">
        <input type="text" id="datetimepicker"/>

setup.ts

page.includeJS.HsRoombooking = EXT:hs_roombooking/Resources/Public/JS/jquery.datetimepicker.full.js

This is include after plugin.tx_hsroombooking._CSS_DEFAULT_STYLE (). Could you let me know what is missing. The textfield is blank. Could you something to include datetimepicker in my extension.

## Antworten

### [#2](https://www.typo3.net/d/127306-unable-to-include-js-file-in-extension/2) · Teisinger · 2019-01-17

Hello,

first it is not good to load your JS in the head tag (except with "defer" or async).
Next it can come to problems with your jQuery Script in the head tag, because what should be selected if the DOM-Tree is not fully loaded? To prevent this you can wrap your JS code like this:

```plaintext
;(function($, root, window, document) {	// Alias Technique
    $(function() {	// Equal to $(document).ready()
        // here your js code
    });
})(jQuery, this, window, document);
```

Next are you shure that your setup.ts is loaded? You can test this if you are in the backend -> Template -> Template analyse (or so)...

-----------

sorry for my english ;)

### [#3](https://www.typo3.net/d/127306-unable-to-include-js-file-in-extension/3) · Meghna · 2019-01-18

Thank you so much!! Your English is perfect! Solved the issue :)

---

Quelle: „Unable to include JS file in Extension“, typo3.net, https://www.typo3.net/d/127306-unable-to-include-js-file-in-extension
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
