Not sure that this is it, but $.fn.myplugin = function(options) { return this.find('form').ajaxForm(); });
? On Jan 6, 1:59 pm, yellow1912 <yellow1...@gmail.com> wrote: > Hi all, I have a question regarding jquery object: > > if I bind my plugin like this: > > $('#myButton').myplugin(); > > And inside my plugin, I want to bind ajaxForm listener to all forms > inside 'this' current element, what is the best way to do it? I can > get the id by using $this.attr('id'), but there is no guarantee that > the users will always pass in an id. > > (function($) { > // > // plugin definition > // > > $.fn.myplugin = function(options) { > // bind ajax form to 'this' > > }}); > > Thank you for your help and suggestions > > Raine