Plugin:
(function( $ ){
$.fn.myplugin = function( options ) {
var mymethod = function(){
// I want to be able to access "this" here ('.element')
return this;
};
return this.each(function() {
// $('.element', this).mymethod(); <- how to do this?
});
};
})( jQuery );
I want to call mymethod like this:
$('.element').mymethod();
Is this possible?
Basically it needs to keep the chaining so I can further call other functions...
jQuery.fn.myplugin(unless you want to be able to use the$alias elsewhere).