SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Threaded View

  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2008
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question document.getElementById

    Hello,

    I'd like to ask you, why doesn't this work:

    <html>
    <head>
    <title>getElementById example</title>

    <script type="text/javascript">

    var target = document.getElementById("para1");
    alert(target.nodeName);

    </script>
    </head>

    <body>
    <p id="para1">Some text here</p>
    </body>
    </html>

    It says that "target is null". But I don't know why. Can anyone help? Thanks.
    Last edited by jake.polak; Jun 30, 2008 at 06:12.


Bookmarks

Posting Permissions

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