> but there do exist two alternative methods -- a) using a $.load() > with a callback in the onOpen function && b) including script in the > remote response
having a separate onLoad feels a bit cleaner and simpler to me. I don't like the way that method a) changes the jqm() parameters by moving the url from the args hash into the onOpen(), and I don't like b) because I prefer to keep my javascript code together and separate from the html. > do you still see the onLoad callback as an essential? IMO, it's worth it. Since all but the most trivial dialog boxes are going to need some kind of events bound to them, it seems worthy of it's own parameter. As a side note, one other thing that might make things look a little cleaner would be to move all the callback parameters into the args hash, so: **************** $('#loginBox').jqm( { ajax: url, trigger: 'trigger', onOpen: function(h) { ... } onLoad: function(h) { ... } }); **************** this avoids ",false,false" if you're not making use of all callbacks and also brings it into line with other jQuery plugins. (well, the Interface plugin at least, haven't really used any others) in any case, thanks for your work on jqModal, in spite of my nitpicking it's still the ideal dialog solution for me Dustin On 2/19/07, Brice Burgess <[EMAIL PROTECTED]> wrote: > Dustin Cram wrote: > > Hi, > > > > I've run into the same problem of needing to bind events to elements > > loaded remotely. Rather than doing this manually in the OnOpen I've > > modified jqModal a bit so that jqm() supports a third, onLoad() > > callback so I can do: > > > > > > **************** > > $('#loginBox').jqm( > > {ajax: some_url, trigger: 'trigger'}, > > false, > > false, > > function(h) { $("#my_button", h.w).bind("click", my_handler); } > > ); > > **************** > > > > Is this something that could be added to jqModal? > > > > If anyone is interested the patched jqModal can be grabbed at > > http://gigs.cx/jqModal.js > > > Dustin, > > Nice addition. I am considering adding something like this to the > base.. but there do exist two alternative methods -- a) using a $.load() > with a callback in the onOpen function && b) including script in the > remote response -- e.g. using the example above, include; > > <script type="text/javascript"> > $('#my_button').bind("click", my_handler); > </script> > > in some_url. > > Keep in mind that jqModal strives to stay on a diet.. do you still see > the onLoad callback as an essential? > > ~ Brice > > _______________________________________________ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/