I didn't expect this to work (with my 'compiler' hat on) but it does: var clickFunction = function() { $inner.doSomething() }; $("div") .append("<div id=inner>bla</div>") .click(clickFunction);
var $inner = $div.find("#inner"); I was expecting an error for $inner to be undefined when the javascript parsed the first line, but the browser script engines seems quite happy with this sort of super-late declaration. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---