Grails - Tag - javascript

Tag - javascript

Description

Allows inclusion of javascript libraries and scripts as well a shorthand for inline Javascript

Parameters

  • library (optional) - The name of the library to include. Either "prototype", "scriptaculous", (pre-1.0) "yahoo" or "dojo"
  • src (optional) - The name of the javascript file to import. Will look in /app/js dir
  • *base (optional - Since 0.6) - specifies the full base url to prepend to the library name

Examples

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

<g:javascript library="scriptaculous" /> // imports all the necessary js for the scriptaculous library

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