Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #19465
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | "Jukka K. Korpela" <jkorpela@cs.tut.fi> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: How do I use getElementById in my situation |
| Date | Thu, 25 Apr 2013 12:35:10 +0300 |
| Organization | A noiseless patient Spider |
| Lines | 26 |
| Message-ID | <klat6f$mji$1@dont-email.me> (permalink) |
| References | <klar57$cfi$1@dont-email.me> <klas9o$idf$1@dont-email.me> <klassf$l35$1@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Thu, 25 Apr 2013 09:31:59 +0000 (UTC) |
| Injection-Info | mx05.eternal-september.org; posting-host="ad9d9996ed56b0226e850b84acbddfdf"; logging-data="23154"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/A7IXG2tuKU0pJvaF21DRT" |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 |
| In-Reply-To | <klassf$l35$1@dont-email.me> |
| X-Antivirus-Status | Clean |
| X-Antivirus | avast! (VPS 130424-1, 24.04.2013), Outbound message |
| Cancel-Lock | sha1:9jreA9YNSYyOS/Nz5mUg8Y8y4kw= |
| Xref | csiph.com comp.lang.javascript:19465 |
Show key headers only | View raw
2013-04-25 12:29, Tony wrote: > When I do this > elem = document.getElementById(item); > elem is null Please teach your newsreader some habits; it now quoted my message comprensively, down to the signature, without marking quotations, and placed your text inside my sig! Anyway, my crystal ball says that your script code is in your <head>, so it will be executed before the browser has read the <body>, so it does not know any id attribute values. The simple (though not most elegant) fix is to place the <script> element at the very end of the <body>, i.e. right before the end tag </body>. Well, it *could* be something else, too, like using id="Elem0" instead of id="elem0". Please post a self-contained testable example or URL for such a thing, if further help is needed. -- Yucca, http://www.cs.tut.fi/~jkorpela/
Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread
How do I use getElementById in my situation "Tony" <tony.johansson@inport.com> - 2013-04-25 11:00 +0200
Re: How do I use getElementById in my situation "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2013-04-25 12:19 +0300
Re: How do I use getElementById in my situation "Tony" <tony.johansson@inport.com> - 2013-04-25 11:29 +0200
Re: How do I use getElementById in my situation "Tony" <tony.johansson@inport.com> - 2013-04-25 11:32 +0200
Re: How do I use getElementById in my situation "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2013-04-25 12:35 +0300
csiph-web