So I have some code,
<div class="chunk" id="">
<div class="chunkContent">
<div class="textLeft" ></div>
<div class="textRight" ></div>
<div class="notes border">Notes...</div>
</div>
<div class="tools fl">
<div class="toggleNotes border">n</div>
<div class="addChunk border">+</div>
</div>
</div>
Now, the two divs nested withing div.tools are small buttons. div.toggleNotes I need to select div.notes in a javascript/jquery function. div.addChunk I need to select the fisrt div, div.chunk. Currently, I am doing this by:
$(".addChunk").live('click', (function(){create_chunk(this.parentNode.parentNode)}))
$(".toggleNotes").live('click',function(){toggle_notes(this.parentNode.parentNode.firstElementChild.lastElementChild)})
Is there a better (i.e., more proper) way to do this than to string together parentNotes and firstElementChild's and etc.? I'm basically looking around the DOM tab in firebug.