www.webdeveloper.com
Results 1 to 3 of 3

Thread: document.appendChild(div);

  1. #1
    Join Date
    Sep 2008
    Posts
    61

    document.appendChild(div);

    My problem is in the code below.. I can't append the child to my document..?
    How could I solve this?

    Code:
    var newdiv = document.createElement('div');
    newdiv.setAttribute("id","moot450");
    newdiv.setAttribute("style", "position:absolute; border:2px solid #000000; width:300px; height:300px;");
    document.appendChild(newdiv);
    Everything works fine, except appending the div to my document.

    Thanks for any help!

    /Artheus

  2. #2
    Join Date
    Apr 2007
    Posts
    71
    document.body.appendChild(newdiv);

  3. #3
    Join Date
    Sep 2008
    Posts
    61
    Thank you bosko!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles