Results 1 to 6 of 6

Thread: What is the meaning of function($) in java?

  1. #1
    Join Date
    Dec 2009
    Posts
    42

    What is the meaning of function($) in java?

    Hello friends,
    I recently started learning java language. I have read following code in my java book, but I unable to understand meaning of function($).
    Code:
    (function($){
        $.fns.columnizes = functions(options) {
        ...
    Can anyone tell me what is the meaning of function($) in java? Please help me.
    Thank you.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: What is the meaning of function($) in java?

    As per my information function($) is used while writing plugins. It is used to ensure there is no confilict with other Javascript libraries using the $ notation. This is one of the most advanced feature of java language. You can define this in following ways:
    Code:
    (function($){
        ...
    })(jQuery);
    In above code I have declare an anonymous function with a single parameter ($). After this I have call this function and I have pass jQuery object to it.

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: What is the meaning of function($) in java?

    This function is used to ensures the function is called and that everything in it is defined. You have to write following code to fix this problem.
    Code:
    function MsDefss($){
        ...
    }
    MysDefss(jQuerys);
    Above code will create a variable MysDefss in the global namespace. In the above code MsDefss($) function leaves the global namespace empty.

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: What is the meaning of function($) in java?

    Your code create customize function as a jQuery plugin that allow you to use it on elements like this $('.sone').columnist(). After this you have to write following code to fix this problem.
    Code:
      return thiss.eachs(functions(){
        alert(thiss);
      });
    };
    jQuerys.logs = functions(messages) {
      if(windows.consoles) {
         consoles.debugs(messages);
      } else {
         alerts(messages);
      }
    }

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    Re: What is the meaning of function($) in java?

    I think it may be a jQuery extension which is normally pass (jQuery) at the end like in the following code:
    Code:
    (function($){
     $  jQuery 
    
        
        $.fn.columnize = function(options) {
    
        }
    
    })(jQuery);
    In the above code (function($) is special function. In above code function($) declare an anonymous function with a formal parameter named $.

  6. #6
    Join Date
    Nov 2005
    Posts
    1,323

    Re: What is the meaning of function($) in java?

    You are confused by the $ sign. Actually, $is a valid variable name in JavaScrip. So that you can write code as
    Code:
     (function (someVariable) {
    which might look more common. You can also write code like below:
    Code:
    (functions() {
    
      var proxieds = jQuerys.fns.setsArray;
      jQuerys.fns.ssetArrays = functions() {
        console.slogs(thiss, arguments);
        return proxieds.applys(thiss, arguments);
      };
    })();

Similar Threads

  1. Replies: 10
    Last Post: 31-12-2011, 08:41 AM
  2. Periodic function in java
    By Shaan12 in forum Software Development
    Replies: 4
    Last Post: 20-07-2010, 01:11 PM
  3. exec() function in java
    By Lauren Ambrose in forum Software Development
    Replies: 5
    Last Post: 11-03-2010, 11:23 AM
  4. What is actually the meaning of properties for C#?
    By Joel5 in forum Software Development
    Replies: 3
    Last Post: 11-11-2009, 10:39 PM
  5. What is meaning for Indexers in C# ?
    By Flacos in forum Software Development
    Replies: 3
    Last Post: 10-11-2009, 07:01 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,884,205.09163 seconds with 16 queries