views:

57

answers:

1

How do I make a jQuery function work with Grails??

I installed the jQuery plugin and added grails.views.javascript.library="jquery" at the end of conf/Config.groovy

And when I trigger the function I get an error saying

Object Expected

I checked the code and is fine, you can check it out here: http://www.jsfiddle.net/dCy6f/

When I write the number into the textfield I get the error.

Any ideas of what I might be doing wrong?? Or maybe I'm missing something??

Thanks in advance!!

+1  A: 

Make sure you have

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

in the <head> section of your view. Put this in grails-app/views/layouts/main.gsp if you want it in all your views.

ataylor
Now I don't get an error, but the function does not get triggered :/
fgualda87
I was missing the `$(document).ready(function(){......});`
fgualda87