i’m just starting to scratch the surface of unobtrusive JS so bare with me…
I have a parent <div> with an id of “content” that contains everything i want to manipulate. Within that <div> there are going to be 1 or more <div>s separating blocks of content (see code). Here’s the deal…
1) I want to capture an array of the “block” <div>s that are one level below the “content” div.
2) I want to capture the array of <div>s that are one level below each “block” div.
I’m assuming if i use the following it will capture ALL <div>s below the “content” not just those one level deep…right?
[code]var blocks=document.getElementById(‘content’).getElementsByTagName(‘div’);
i’ve been playing with using childnode calls, but i’m not grasping it i guess. i also have to deal with other possible content besides the divs. Any suggestions?
…and here’s the markup…
[code]<div id=”content”>
<div><!– BEGIN BLOCK 1 –>
<img src=”xxx” />
<div>
stuff here…
</div>
<div>
stuff here…
</div>
<div>
stuff here…
</div>
</div><!– END BLOCK 1 –>
<div><!– BEGIN BLOCK 2 –>
<img src=”xxx” />
<div>
stuff here…
</div>
<div>
stuff here…
</div>
<div>
stuff here…
</div>
</div><!– END BLOCK 2 –>
</div>