I just did this for my masked input plugin.

$.fn.foo=function(){

  return this.each(function(){
     function bar(){
        //Do Something useful here
        //Note: this function is deeply buried in scope and
unaccessible from outside
     }

     $(this).bind("keydown",bar);

     $(this).one("unfoo",function(){
        $(this).unbind("keydown",bar);
     });
  });
}

$.fn.unfoo=function(){
   return this.trigger("unfoo");
})

-Josh
digitalbush.com

On Sep 10, 6:17 am, Mika Tuupola <[EMAIL PROTECTED]> wrote:
> On Sep 10, 2007, at 11:17 AM, Richard D. Worth wrote:
>
> > Each plugin itself must be written to expose a method to remove it
> > from an element. Something like
> > $("input").fooDestroy()
>
> Maybe I am missing something obvious :) How does this method remove
> the plugin instance from the element? Can you provide example code?
>
> --
> Mika Tuupolahttp://www.appelsiini.net/

Reply via email to