Skip to main content

Questions tagged [includejs]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer

Pass Craft Field String to Javascript Function

I tried different solutions given here, here and here. But I get nothing to work, probably missing something small and simple. I have this variable in a .js File: var dziFilesUrl = 'http://...
Henrik's user avatar
  • 425
4 votes
1 answer

Register JS files at the end of the body tag in the Control Panel

I would like to add my own external JS sources at the very end of the body tag in the Craft control panel. I've already tried using: {% do view.registerJsFile("<CDN_URL>", {position:3}) %} ...
Chris Angel's user avatar
1 vote
0 answers

Avoiding includeJsFile, includeJS from caching

In my template, I have an includeJSFile that loads properly on the first load, but disappears on subsequent loads. The includeJSFile is outside the caching tags, so I'm not sure why this is still ...
user3092's user avatar
  • 117
1 vote
1 answer

includeJs not consistently working

Using Craft 2 and I have a Matrix Block which can contain a carousel item, which uses JS/jQuery. Because the content editor can add multiple instances of this Matrix Block I can’t set up these ...
richardpixel's user avatar
1 vote
1 answer

Simplify Twig/JS loop code

Can any help simplify this js/twig code? The code links to some tabs that show floorplans of the property being sold. The specified aria-controls refers to a supertable field called floorLevel that ...
mention79's user avatar
  • 543
1 vote
1 answer

Pass Craft field object to JavaScript function

I need to pass an entire Craft object into a JavaScript function. I followed the instructions in this post, however this only covers passing in a string. {% includeJsFile "/js/homepage.js" %} {% set ...
Molly Harper's user avatar
5 votes
3 answers

Can you set async defer when using {% includeJsFile %}?

Is there a way to set async defer on a <script> tag with the built in: {% includeJsFile %} It's for Google Maps e.g.: <script src="
alexr's user avatar
  • 628
3 votes
2 answers

how to includeJsFile in head instead of body

I am using this code to include a js file, but it adds to the <body>: {% includeJsFile '/path/script.min.js' %} I need to add it to the <head> instead, how can I do?
neoDev's user avatar
  • 285
1 vote
1 answer

minify javascript with includeJS

If i include javascript in a template using: {% set myJS %} //some JS in here {% endset %} {% includeJS myJS %} Is there a way to minify the javascript that gets output on the page? I had a look at ...
alexr's user avatar
  • 628