"Fossies" - the Fresh Open Source Software Archive

Member "grails-core-5.2.4/grails-docs/src/test/resources/docs/ref/Tags/javascript.html" (14 Sep 2022, 59815 Bytes) of package /linux/www/grails-core-5.2.4.tar.gz:


Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. You can here alternatively try to browse the pure source code or just view or download the uninterpreted raw source code. If the rendering is insufficient you may try to find and view the page on the grails-core-5.2.4.tar.gz project site itself.

(Quick Reference)

javascript

Purpose

Includes JavaScript libraries and scripts as well as providing a shorthand for inline JavaScript.

Examples

// actually imports '/app/js/myscript.js'
<g:javascript src="myscript.js" />

<g:javascript>alert('hello')</g:javascript>

Description

If you do not include a "src" attribute but instead provide a body, the result is an inline script.

If you use this tag to render inline JavaScript code, it is recommended that you use the Resources plugin’s <r:script> tag to produce inline script that is included at the end of the body, or in the head if necessary - rather than inline. For more control use the Resources plugin’s <r:script> tag directly.

Attributes

  • contextPath (optional) - the context path to use (relative to the application context path). Defaults to "" or path to the plugin for a plugin view or template.

  • src (optional) - The name of the JavaScript file to import. Will look in /appname/js directory

  • plugin (optional) - The plugin to look for the JavaScript in