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 9001399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:25:52+00:00 2026-06-16T00:25:52+00:00

A quick question about jQuery’s each() function; When I use each() , it’s usually

  • 0

A quick question about jQuery’s each() function;

When I use each(), it’s usually because I want to affect all the elements apart from just one. For instance:

$("a.aboutMenu").each(function () {
    $(this).css("color","#FFF");
});

$(this).css("color","#111");

Is there a shorthand way of writing this better? I realise I could put an if in the each function, but there must be someway of writing “each except $(this)“?

  • 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-16T00:25:52+00:00Added an answer on June 16, 2026 at 12:25 am

    Is exactly the same thing if you see on the jQuery API.

    In your example you are saying: for each a.aboutMenu to change the css color to be white.

    You can also write:

    $.each('a.aboutMenu', function() { $(this).css("color","#FFF");} });
    

    If you need a control just add an if inside your function.


    EDIT:

    To remove just this element you can write:

    $('.aboutMenu').not(this).css('color', '#FFF');
    

    or better:

    $('.aboutMenu').not(this).addClass('whiteColor');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just a quick question about JQuery's Ajax function, more specifically, the url parameter. My
I have a quick question about jQuery's AJAX function. The way I do my
I have a quick question about jquery .. I want to find < a
Quick question about data joining. Say I have some elements that each contain a
Quick question about Wordpress PHP: I am writing a theme and I want to
I have quick question about jQuery plugins, hope somebody out there has some advice.
quick question. I am trying to use either javascript, jquery, or php to make
I have a quick question about jQuery selectors. Is doing this: $('.class_el_1, .class_el_2').hide(); The
Quick question about jQuery and DOM traversal. Look at the code below and tell
quick question about Heroku. My app is using a gem called opentok. To function

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.