We help IT Professionals succeed at work.

document.getElementById fails

codequest
codequest asked
on
Medium Priority
599 Views
Last Modified: 2006-11-18
why might    document.getElementById("XYZ")     fail?    I can look at the page source and see the table ID "XYZ" in the page...and can only find one such ID (searched, using pagespy).....plus it was working before I made the latest round of changes...

But it keeps coming up null.

Any suggestions would be appreciated.

Thanks!
Comment
Watch Question

Awarded 2006
Top Expert 2006
Commented:
Syntax error In the HTML or in the javascript. Try Firefox browser to pinpoint errors (In FF: Tools -> Javascript Console)

Is there an equal sign? Matched quotes? Matched case? etc.

<table id="XYZ">

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
b0lsc0ttIT Manager
CERTIFIED EXPERT
Commented:
codequest,

What were the changes you made?  Besides the good things mentioned by Callrs the message may be appearing because of what you are looking for when you get Null.  What is the line that is giving the Null?

Let me know if you have any questions or need more information.

b0lsc0tt

Author

Commented:
Thanks for input.  Problem shifted...I'm working on a puzzle and this was a test case.  Points will be awarded...I'll leave this open a while to see if need reappears.
HonorGodSoftware Engineer
CERTIFIED EXPERT
Commented:
1 possibility is a syntax error in the element associated with the specified ID

Author

Commented:
Thanks for input.  This is resolved...must have been what callrs suggested.   Points to others for cross-validation.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.