1

This is a new one on me.

In FF 3.6.3, use of the word 'script' in a tag id seems to make the id return null when searched on with document.getElementById.

Thus document.getElementById("blah_script") returns null from <div id="blah_script"></div>.

Understood that 'script' in general is a reserved word, but I didn't know it was so spooky that a mass-adopted browser would care if it was in a tag id with a preceding expression for disambiguation.

Justin Johnson
  • 30,978
  • 7
  • 65
  • 89
user352209
  • 11
  • 1
  • Works for me in 3.6.3. What's your Firefox version and DOCTYPE? – harpo May 27 '10 at 17:28
  • 6
    Make sure that the code calling `getElementById` is running *after* the `
    ` shows up in the DOM.
    – Pointy May 27 '10 at 17:29
  • I'm quite sure Pointy is right about the real problem. I can't imagine Firefox introducing this "you can't use the word 'script'" behavior. This answer may be useful for background if he is right (caveat: yes, it's one of mine): http://stackoverflow.com/questions/2920129/can-i-run-javascript-before-the-whole-page-is-loaded/2920207#2920207 – T.J. Crowder May 27 '10 at 17:36
  • 1
    Pointy called this correctly- otherwise the return would be an error, not 'null' – kennebec May 27 '10 at 19:40
  • 1
    It ticks me off when people ask a question and abandon it – Ruan Mendes Dec 17 '10 at 00:16

0 Answers0