Sample Code in my php <div id="mainDiv" style="display:none" > <div id="innerDiv" style="display:none" ></div> <div id="outerDiv" style="display:none" ></div> </div> in my function I display the mainDiv using. Element.show(''mainDiv''); Then I do a Ajax.Updater and the first time I try to load the content into the innerDiv. I get innerDiv is not defined in FireBug. I know what the reason for this is; that in my first call I show the parent Div "mainDiv" but the innerDIV has not registered with the DOM. My question is how do I show the parentDiv("mainDiv") and the child div at the same time so when I do my Ajax.Updater the childDiv("innerDiv") is registered with the DOM and I can place the XHTML into that div? After this works I flip the content out between the two div''s. That way one div is displaying the content to the user and the other div is getting new content. I --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Thu, Apr 24, 2008 at 1:31 PM, seran128 <jeff.php-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I know what the reason for this is; that in my first call I show the > parent Div "mainDiv" but the innerDIV has not registered with the DOM.Um ... in general, calling show() on a parent element causes its children to be displayed too (unless they''re specifically hidden as well). And incidentally, displaying an element doesn''t "register" it with the DOM--the entire DOM is built up as the page loads; even hidden elements are added to the DOM, they''re just not visible in the browser. So I''m not sure what the problem in your code is, without seeing the code. Bonus tip: if you''re using the latest version of Prototype (and you really should be), you can write $(''mainDiv'').show() instead of Element.show(''mainDiv''). :Dan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Apr 24, 9:31 pm, seran128 <jeff....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Sample Code > > in my php > > <div id="mainDiv" style="display:none" > > <div id="innerDiv" style="display:none" ></div> > <div id="outerDiv" style="display:none" ></div> > </div> > > in my function I display the mainDiv using. > > Element.show(''mainDiv''); > > Then I do a Ajax.Updater and the first time I try to load the content > into the innerDiv. I get > innerDiv is not defined in FireBug. >Do you try to load it when the page is loading? In that case you might want to wrap your ajax-call in a dom loaded observer... document.observe(''dom:loaded'', function(){ //ajax call here }) This ensures that all your DOM elements are actually loaded before you try calling them. Greetz, Wizz> I know what the reason for this is; that in my first call I show the > parent Div "mainDiv" but the innerDIV has not registered with the DOM. > My question is how do I show the parentDiv("mainDiv") and the child > div at the same time so when I do my Ajax.Updater the > childDiv("innerDiv") is registered with the DOM and I can place the > XHTML into that div? After this works I flip the content out between > the two div''s. That way one div is displaying the content to the user > and the other div is getting new content. > > I--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---