Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8793771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:09:56+00:00 2026-06-13T23:09:56+00:00

I have a page where the markup includes nested definition lists of both random

  • 0

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:

  1. zebra stripe the groups of DT/DDs with one another and
  2. to start the even/odd sequence over for each nested list that is encountered.

    • Using :even and :odd won’t work because of the extra DDs.
    • I’ve tried using an each loop, shown here: http://jsfiddle.net/XJ9j4/, which fixes A but ignores B. i.e. compare the background color of the 1st child dt/dd combination to the 1st parent, and consider the return to the parent list which should be blue not green.

Thoughts?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:09:56+00:00Added an answer on June 13, 2026 at 11:09 pm

    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");
    });
    

    http://jsfiddle.net/XJ9j4/8/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have markup in my page that includes the tag: <body> <object codebase=blah codetype=text/blah>
I have an ASP.NET page which includes markup and 3rd party controls (in this
I have a web page that uses jquery ajax to grab the table markup
I have the following markup inside a master page <html xmlns=http://www.w3.org/1999/xhtml > <head runat=server>
I have the following markup: <p class=managebox> <button value=Add page> <img src=page_add.png alt=Add more
I have page, i can contact directly without any problems. http://www.mysite.com/app_dev.php/comments/22 the page shows
We have a Wicket app with a page that includes an embedded Youtube video.
I have the following markup on my page <td colspan=2> <table border=0 cellpadding=3 cellspacing=1
I have a few tabs on a page that have this markup <div id=holiday-details-nav>
I have export button, onclick event creates markup of some current asp.net page's controls

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.