Hide when another div is selected?!?!?

I’m trying to make a comment script with show/hide divs and are so far OK, but…

I want to hide one div when another is activated…

Here is what I have so far:

for ($q = 1; $q <= 5; $q++) {
	echo '<div id="jdivStart'.$q.'" style="padding:0px 0px 0px 0px;width:100%x;">';
	echo '<textarea style="color:#999999;" rows=2 cols="66" onfocus="jchange'.$q.'(\\'jdiv'.$q.'\\');">Write comment</textarea>';
	echo '</div>';
	echo '<div id="jdiv'.$q.'" style="display:none;">';
	echo '<textarea style="color:#999999;" rows=6 cols="66"></textarea>';
	echo '</div>';
	<script language="javascript" type="text/javascript">
	function jchange<? echo $q; ?>(divname) {
		var currentShowingDivQ = document.getElementById('jdivStart<? echo $q; ?>');
		var objDivQ = document.getElementById(divname);
		if (currentShowingDivQ && currentShowingDivQ != objDivQ) { 
			currentShowingDivQ.style.display = 'none';
		if(objDivQ.style.display == 'none'){       
			objDivQ.style.display = 'block';
		} else {       
			objDivQ.style.display = 'none';   


So if I activate the first textbox, then when I activates the second I want to be able to hide the first again…

Any help i appreciated :slight_smile:

The standard technique is to on each activation event, to turn off all sections, and then to turn on only the one that needs to be activated.

Hmmm… Not quite sure how to or what you mean…