ubiquibacon
ubiquibacon

Reputation: 10667

Where to place, and how to access a jQuery plugin in a Grails application?

My question is similar to this question. I am wondering where I would place a jQuery plugin in my Grails application, specifically the jQuery numeric plugin.

Once I have that plugin in the proper location, how do I access it from my view? I ask this because when I use jQuery in Grails (version 1.3.7) I use the plugin I found here, and to access jQuery after installation of that plugin I use the following code in my <head> tag:

<g:javascript library="jquery" plugin="jquery"/>

So with that said, what code do I need in my head tag so I can access the numeric plugin?

Upvotes: 3

Views: 1570

Answers (1)

OverZealous
OverZealous

Reputation: 39560

Follow these steps:

  1. Add your .js file(s) to web-app/js/, which will make them available in the deployed application under <context-root>/js/
  2. Add this tag to your header, either in the main layout, or a GSP if not needed everywhere.

    <g:javascript src="plugin.jquery.js"/>

See here for more information on the g:javascript tag.

Upvotes: 5

Related Questions