what is the correct syntax to create a namespace within jquery, so as to allow the passing of the matched set to nested methods?
this is what I have:
(function($) {
var nameSpace = {
module: function(x){
}
}
})(jQuery)
but calling $('.selector').nameSpace.module() returns
Cannot call method 'module' of undefined
This will not work as you have not added anything to
jQuery.fn, which is where all plugins get added. You will likely run into issues even if you did this though as jQuery does some fancy things with howthisis bound.If you wish to have multiple methods on a single plugin i would suggest reading through the jQuery documentation on namespacing plugins
Hope that helps