Q:

uncaught TypeError: object is not a function (anonymous function) in grails

In my gsp, i have the following code.
$ = jQuery.noConflict();
      j$(function($){
          j$(document).ready(function(){
              j$('#news-container').vTicker({
                  speed: 500,
                  pause: 3000,
                  animation: 'fade',
                  mousePause: true,
                  showItems: 1
              });
              j$(document).keydown(function(event) {
                  $("#helpLinkId").hide();
              });
          });
      })(jQuery);

When run, it gives like uncaught TypeError: object is not a function (anonymous function). What is the solution for this?

A:

You are assigning jQuery to $ instead of j$ and later you are using j$ to refer to jQuery, but j$ has no value assigned to it
it should be
// instead of assigning jQuery to $ you need to assign it to j$
j$ = jQuery.noConflict();
j$(function($) {
    j$(document).ready(function() {
        j$('#news-container').vTicker({
            speed : 500,
            pause : 3000,
            animation : 'fade',
            mousePause : true,
            showItems : 1
        });
        j$(document).keydown(function(event) {
            $("#helpLinkId").hide();
        });
    });
});//there is no need to pass jQuery here

