i'm in the midst of developing an application with many jquery
plugins, and i've just run into a bizarre problem.  my app uses a lot
of ajax to populate different divs that i'm sorting using sortable.
anyhow, the issue is as follows.

on document ready, i go through each div on the page and ajax in the
content for it using .load().

$("div.widget")
        .each(function() {
                var w = this.id;
                var wid = $(this).attr("title");
                var h = $(this).attr("alt");
                $(this)
                        .load(w+"/index.cfm",function(){
                                var choices = {};
                                $("##"+w+"_choices li").each(function(i) {
                                                                                
        var c = $(this).text();
                                                                                
        choices[i] = c;
                                                                                
});
                                makeMenubar(w,wid,choices);
                                widgetInitCall(w);
                        });
        });

once it arrives, i call another function to find a specific h1 in it
and add some buttons, one to close the div and one to access a menu.

        function makeMenubar(w,wid,c) {
                var menu = $("##"+w+"Header");
                menu.append("<a class='close' id='"+w+"_close'/>");
                menu.append("<div class='menubutton' 
id='"+w+"_menubutton'></div>");
                $("##"+w+"_menubutton").click(function(e) {var f = new
FileMenu(w,e.clientX,e.clientY,c);      });
                $("##"+w+"_close").click(function() {closeWidget(wid,w);});
        }

the problem i'm having is that if i attempt to use ANY PLUGIN AT ALL
in the anonymous functions bound to those clicks (or any functions
called by those functions), i get a "not a function" error in my
firebug console.  i'm ultimately attempting to use ajaxForm() on a
form that gets ajaxed in, but in debugging it i found that even
something as simple as the following ends up erroring out.

        $("##"+w+"_menubutton").click(function(e) {
                        alert($(this).outerHeight());
                });

all the plugins that i want to use are in the page and work fine if i
call them from somewhere higher up.  can anyone offer any insight? i
couldn't find anything about losing access to all plugins at certain
point in the call stack. this is really throwing a kink in the middle
of my day.  thanks a lot.

--adam

Reply via email to