pennstatephil
pennstatephil

Reputation: 1643

Where do I put javascript functions in grails to have it accessible?

I have a script to check/uncheck all boxes on a form in a grails application that I am trying to call. I included the function (in <g:javascript> tags) in the head section of the page, and even added an alert before declaring the function to make sure the code block was being processed (it worked), but when I hit my check/uncheck all button, firebug tells me that it can't find the symbol; and looking at the source code, the function doesn't seem to be present. Where do I put this to get grails to include this function?

Upvotes: 0

Views: 516

Answers (1)

sbglasius
sbglasius

Reputation: 3124

in your web-app/js library, naming it yourScript.js

You include them in your your page by

<g:javascript library="yourScript"/>

Notice the lack of .js in the tag

Upvotes: 2

Related Questions