javaScriptIncludeTag()
Description
Returns a script tag for a JavaScript file (or several) based on the supplied arguments.
Function Syntax
javaScriptIncludeTag([ sources, type, head ])
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
sources |
string |
No | |
The name of one or many JavaScript files in the javascripts folder, minus the .js extension. (Can also be called with the source argument.) |
type |
string |
No | text/javascript |
The type attribute for the script tag. |
head |
string |
No | false |
Set 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. |
Examples
<!--- view code --->
<head>
<!--- Includes `javascripts/main.js` --->
#javaScriptIncludeTag("main")#
<!--- Includes `javascripts/blog.js` and `javascripts/accordion.js` --->
#javaScriptIncludeTag("blog,accordion")#
</head>
<body>
<!--- Will still appear in the `head` --->
#javaScriptIncludeTag(source="tabs", head=true)#
</body>
