How do I create a jQuery plugin so that I can use namespaces in my plugin ?
$(\"#id1\").amtec.foo1();
$(\"#id1\").amtec.foo2();
None of th
$.cg = {
foo1: function(weq){
return console.log(weq);
},
foo2: function(rw){
return console.log(rw);
}
};
$.cg = { // will result in error because $.cg is already declared above
foo4: function(rw){ // will result in error
return console.log(rw); // will result in error
} // will result in error
}; // will result in error
$.cg.foo3 = function(weq){ //to add anything new to $.cg , you have to do it this way.
return console.log(weq);
}
$.cg.foo1("12");
$.cg.foo2("22"); //works fine.
$.cg.foo3("112"); //works fine.