How to add Ajax loaded HTML to the page DOM ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • haderach
    New Member
    • Apr 2007
    • 1

    How to add Ajax loaded HTML to the page DOM ?

    Hi everyone,

    I have a HTML page and I'm replacing a div by some HTML code using Ajax.

    The problem is that I cannot access the newly added HTML tags as their IDs are not part of the original page DOM, so getElementById etc won't work.

    How can I add the loaded HTML (or XML) to the current page DOM? Note that I'm also using prototype, does pt offer a way to resolve this kind of problem?

    Best regards
    Haderach
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Once the HTML is added to the page, the elements should be accessible.

    Comment

    • myth0s
      New Member
      • Jan 2008
      • 32

      #3
      Originally posted by haderach
      Hi everyone,

      I have a HTML page and I'm replacing a div by some HTML code using Ajax.

      The problem is that I cannot access the newly added HTML tags as their IDs are not part of the original page DOM, so getElementById etc won't work.

      How can I add the loaded HTML (or XML) to the current page DOM? Note that I'm also using prototype, does pt offer a way to resolve this kind of problem?

      Best regards
      Haderach
      The DOM is dynamic. So as long as you set the ID of the elements you add, everything should be fine.

      Comment

      Working...