Thanks... And what's up with the:
(function($) { // CODE })(jQuery); This was the thing that got me most confused when reading the documentation. Can someone explain me this, what it does, what is for and the best scenarios where would I need to use something like this? If possible, explain me like I was really dumb :P Klaus Hartl wrote: > On Feb 23, 12:14�am, Nazgulled <[EMAIL PROTECTED]> wrote: > > Hi, > > Let's say I have 2 different javascript files. I like to organize my > > code that's why I use 2 different files so each file will only have > > functions that fall into that file's category. > > > > Anyway, here's the files layout... > > > > file1.js: > > function Fn1() { ... } > > function Fn2(a, b) { ...} > > > > file2.js > > function FnX(a, b, c) { ... } > > function FnY(a, b) { ... } > > function FnZ(a) { ... } > > > > How can I call those functions in a syntax like this: > > $.groupName.Fn1(); > > $.groupName.Fn2('text', 123); > > > > or > > > > jQuery.groupName.FnZ(true); > > > > How do I do this? > > > > P.S: I've read the plugins authoring documentation page but I'm still > > confused and I don't know how to achieve this, please advise... > > Something like: > > $.groupName = $.groupName || {}; > $.extend($.groupName, { > Fn1: function() { > ... > }, > Fn2: function(a, b) { > ... > } > }); > > > --Klaus