Trouble with DOM traversal.
I am trying to write a function that will allow me to capture the ID of the next target down the dom to the span that is clicked. Assuming the class of all the target containers is "target"
Given this
<wrap1><span1><span2><span3></wrap1>
<target></target>
I can use span3.parent().next("target").attr("id") to get the ID of the target element
Given this I can't figure out how to do the same
<wrap1><span1><span2><span3></wrap1>
<wrap2>
<target></target>
</wrap2>
The biggest part of the problem is that I could have both blocks on the same page many times in any order so I need to write a function that can deal with both scenarios. Stumped..
M