Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: appendChild

  1. #1
    Regular Coder sitNsmile's Avatar
    Join Date
    Dec 2009
    Location
    Charlotte, NC
    Posts
    358
    Thanks
    19
    Thanked 2 Times in 2 Posts

    appendChild

    Hello,

    If I have a <div id="mydiv"></div>
    and I use

    Code:
    iframe = document.createElement("iframe");
    document.getElementById("mydiv").appendChild(iframe)
    Does the iframe append after </div> <iframe>
    or does it append <div id="mydiv"> <iframe> </div>

    Thanks

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,133
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    Did you try it, say with Firebug or another debugger present?

    a *child* is indeed *INSIDE* the parent that appended it.

    SO
    Code:
    <div id="mydiv">
        <iframe />
    </div>
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •