Hi Tony. Thanks for the reply. Unfortunately I can't post. But I can
explain.
<div class="location">LOCATION1 WITH JS ONCLICK CALL</div>
<div id="comment1"></div>
Upon clicking of LOCATION1, an AJAX call fills comment1. The div fills
below as expected. Upon clicking LOCATION1 again, I want to return the
comment1 div back to its original state. Since my options were to set
its display to "none", the whole thing disappeared, having an accordion
effect on the stuff that is below these two lines.
I will try setting visibility from visible to hidden.
Cheers
> > Hi folks. Sorry for the semi-cross-posting in the CSS group. I have a
> > question with regards to turning on and off a div.
[quoted text clipped - 19 lines]
> the most likely to be believed by conspiracy theorists. Fitting the
> actual facts is optional."
> Hi Tony. Thanks for the reply. Unfortunately I can't post. But I can
> explain.
Just a note - it is generally considered better to respond at the
bottom, or to interlave your responses (as I am here) - it provides
better context.
> <div class="location">LOCATION1 WITH JS ONCLICK CALL</div>
> <div id="comment1"></div>
[quoted text clipped - 4 lines]
> its display to "none", the whole thing disappeared, having an accordion
> effect on the stuff that is below these two lines.
OK - so as I understand it, then, comment1 exists before you make the
ajax call. You then make the call & put the response into comment1.
Using innerHTML, by any chance?
How about:
document.getElementById('comment1').innerHTML = '';
That will clear the div but keep it in its place - now empty.
> I will try setting visibility from visible to hidden.
That will preserve all the space for the DIV, but make it unseen. That
may do what you want.

Signature
"The most convoluted explanation that fits all of the made-up facts is
the most likely to be believed by conspiracy theorists. Fitting the
actual facts is optional."
BeeRich - 30 Jun 2006 10:26 GMT
Hi Tony. I got it to work. I went back to the display: none routine.
I'm relatively new to JS, so my previous attempts got me messing up my
IF routine.
Cheers