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

  • SEARCH
  • Home
  • 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 8486599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:59:23+00:00 2026-06-10T20:59:23+00:00

Following the instructions in the comments of the function below, I tried to select

  • 0

Following the instructions in the comments of the function below, I tried to select every member of the class ‘piece,’ divide it in half (using :even :odd selectors) and then add two different classes to them. But I’m getting an error message that that says there are 0 members of each class. Have I selected them incorrectly?

function setUpPieces() {
    //select all the divs with class 'piece'
    //add the 'light' class to half of them
    //add the 'dark' to the other half
    $('.piece:even').addClass('light');
    $('.piece:odd').addClass('dark');

}

Update:

These are the instructions

The jQuery selectors :even and :odd may be useful.

An example:

$('div:even')
selects half of the divs on the page: the first one (the one at index 0) and then every second div after it (the ones at indicies 2,4,6 ...)

$('div:odd')
selects the other half.
  • 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-10T20:59:25+00:00Added an answer on June 10, 2026 at 8:59 pm

    When is the setUpPieces function running? Make sure you’re applying that after the document ready. The code you have to add the classes look correct. Here’s a Fiddle showing it in action:

    http://jsfiddle.net/DeGeb/

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

Sidebar

Related Questions

Following the instructions at the Observer User Guide , I tried to run the
Tried following the instructions here: How to use Google app engine with my own
I'm following the instructions on using xsi:type from this oft-cited blog post: http://blog.bdoughan.com/2010/11/jaxb-and-inheritance-using-xsitype.html Basically
I tried to create a new folder following the instructions at https://developers.google.com/google-apps/documents-list/#creating_a_new_document_or_file_with_metadata_only instead of
I tried following instructions: >>> values ['9', '31', '32'] >>> map('abc'.join, values) and got:
I'm using MGTwitterEngine and OAuthConsumer frameworks. And mostly following the instructions at UsingOAuthConsumer .
I am trying to install node.js following instructions. Just installed Homebrew. I tried this.
I have registered my web application for use with oath2 using the following instructions:
I have followed the following instructions in setting a git repository locally in one
I installed wxWidgets-2.8.10 following instructions from this page: http://wiki.wxwidgets.org/Compiling_and_getting_started Libraries directory: alex@alex-linux:/usr/local/lib$ ls |

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.