I have this function that that will reset the display attributes of all divs within a div to none then sets the selected one to block.
function Test(id)
{
var allFiles = document.getElementById("FileContainer").getElementsByTagName("div");
for(i=0; i< allFiles.length; i++)
allFiles[i].style.display="none";
var selected = document.getElementById(id);
selected.style.display="block";
}
Problem is though that this also sets the display to none for the child divs of the child div as well. How can I make it only apply to the first child level?
<div id="FileContainer">
<div id="test-1"> //Set display to none
<div id="test1.1"> //Do not set display to none
</div>
<div id="test-2"> //Set display to none
<div id="test1.1"> //Do not set display to none
</div>
</div>