I am moving some code into a plugin and am stuck on something that is probably very simple.
My plugin creates new DOM nodes, but once they are created I need to bind events to them. I'm not seeing an obvious way to do the binding from within the plugin itself. I'd like to just do this: $('foo').myplugin(); ...but right now I have to do this: $('foo').myplugin(); bindStuff(); I'm using the recommended "return this.each(function(){ ...})" structure for my plugin, so if I call the binding function from within that block, it'll get called n times, when it only needs to be called once. I'm sure I'm missing something obvious, but I haven't written too many plugins yet.. .each() doesn't have a callback does it? Thanks, Jason