I have 2 DIVs on an HTML page:
<div id="divDebug" />
<div id="divResult" />
I have a script that hits a web service and fills them up with data:
document.getElementById("divDebug").innerHtml = rawResult;
document.getElementById("divResult").innerHtml = processResult(rawResult);
Here's my problem:
document.getElementById("divResult") evaluates to null.After much trial and error, I found out that if I change the HTML code to:
<div id="divDebug"></div>
<div id="divResult"></div>
Everything works well in all 3 browsers.
My questions are:
Thanks!
<div/> is the XML way of closing tags, basically. <div></div> is HTML (and XML).
What DOCTYPE are you using?
From C. HTML Compatibility Guidelines in XHTML™ 1.0 The Extensible HyperText Markup Language (Second Edition):
C.3. Element Minimization and Empty Element Content
Given an empty instance of an element whose content model is not EMPTY (for example, an empty title or paragraph) do not use the minimized form (e.g. use
<p> </p>and not<p />).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With