I have a page where the markup includes nested definition lists of both random depth and random numbers of DDs associated with any DT. Thus:
DL
- DT
- DD
- DT
- DD
- DD
--DL
--DT
--DD
--DT
--DD
--DD
-DT
-DD
-DD
I need:
to start the even/odd sequence over for each nested list that is encountered.
Thoughts?
With my new understanding of what you want, I think this will do. Let me know if I am still misunderstanding.
$("dl").each(function(){
$this = $(this);
$this.children("dt:even").addClass("even").nextUntil("dt").addClass("even");
$this.children("dt:odd").addClass("odd").nextUntil("dt").addClass("odd");
});