Skip to content

Miscellaneous

javaScriptIncludeTag()

javaScriptIncludeTag() — returns any

Returns a script tag for a JavaScript file (or several) based on the supplied arguments.

NameTypeRequiredDefaultDescription
sourcesstringyesThe name of one or many JavaScript files in the javascripts folder, minus the .js extension. (Can also be called with the source argument.) Pass a full URL to access an external JavaScript file.
typestringyesThe type attribute for the script tag.
headstringyesSet to true to place the output in the head area of the HTML page instead of the default behavior, which is to place the output where the function is called from.
delimstringyes","the delimiter to use for the list of javascripts
javaScriptIncludeTag([ sources, type, head, delim ]) <!--- view code --->
<head>
    <!--- Includes `javascripts/main.js` --->
    #javaScriptIncludeTag("main")#
    <!--- Includes `javascripts/blog.js` and `javascripts/accordion.js` --->
    #javaScriptIncludeTag("blog,accordion")#
    <!--- Includes external JavaScript file --->
    #javaScriptIncludeTag("https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js")#
</head>

<body>
    <!--- Will still appear in the `head` --->
    #javaScriptIncludeTag(source="tabs", head=true)#
</body>