I'm not sure I completely understand what you're looking for, but it sounds like you're in need of using event delegation so that something can be added and will get handled by a click handler that was defined before it was added. Here's a good article:

http://www.learningjquery.com/2008/03/working-with-events-part-1

- Jack

Andrew wrote:
Any feedback?

On Jun 3, 11:24 am, Andrew <andrew.alcant...@hotmail.com> wrote:
Hi All,

I have a plug-in that adds onclick event to an element, below is a
snippet?

jQuery.fn.showBox = function(options) {
  var options = {title:"the title",content:"the content"};
   return this.each(function(){
        var obj = $(this);
        obj.bind("click",function(e){
                // perform dynamic div show
                // add and show a div box below element
        });
    });

}

Now here is my question, is there a way I can make the same function
so that I can call it as a method of jquery without recreating the
code for adding and showing the div box.

What I need is to call this showBox (as $.showBox(options)) and will
perform the dynamic div?

Any help is much appreciated.

Thanks.


Reply via email to