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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:08:25+00:00 2026-06-10T01:08:25+00:00

Wondering if somebody could help me figuring this out, I have a list; basically

  • 0

Wondering if somebody could help me figuring this out, I have a list; basically I want jQuery to check if inside every div with class “bullet-btn” a children element has a class “icon-thumbs-up” if so find another element inside the same div with a class “badge” and change color of it.

Basically the way I have the script is not filtering the all list and it is selecting all the element with class “icon-thumbs-up” any ideas?

Here is my html

<ul class="content-box">
<li>
    <div class="bullet-btn">
    <h1>Hamburger</h1>
    <span class="counter badge">389</span>
    <span class="icon-thumbs-up"></span>
    </div>
    <div class="bullet-btn">
    <h1>Sirloin</h1>
    <span class="counter badge">389</span>
    <span class="icon-thumbs-down"></span>
    </div>
    <a href="#">View All Trending Topics...</a> 
</li>
<li>
    <div class="bullet-btn">
    <h1>Brett</h1>
    <span class="counter badge">389</span>
    <span class="icon-thumbs-down"></span>
    </div>
    <div class="bullet-btn">
    <h1>Jenny</h1>
    <span class="counter badge">389</span>
    <span class="icon-thumbs-up"></span>
    </div>
    <a href="#">View All Trending Topics...</a> 
</li>
<li>
    <div class="bullet-btn">
    <h1>Lighting</h1>
    <span class="counter badge">389</span>
    <span class="icon-thumbs-up"></span>
    </div>
    <div class="bullet-btn">
    <h1>Music</h1>
    <span class="counter badge">389</span>
    <span class="icon-thumbs-down"></span>
    </div>
    <a href="#">View All Trending Topics...</a> 
</li>
</ul>

Here is my jQuery

     if ($('div.bullet-btn').children('.icon-thumbs-down').length > 0) {
    $(this).find(".badge").css({'color':'red'});
} else {
    $(this).find(".badge").css({'color':'white'});
}
  • 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-10T01:08:27+00:00Added an answer on June 10, 2026 at 1:08 am
    $('.bullet-btn').each(function() {
        var color = $('.icon-thumbs-down', this).length ? 'red' : 'white';
        $('.badge', this).css('color', color);
    });
    

    Here’s the fiddle: http://jsfiddle.net/PSSWc/

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

Sidebar

Related Questions

i was wondering if somebody could help me out. I have a plan of
Was wondering if somebody could please help me solve this. I've follwed all steps
Hi there I was wondering if somebody could help me? I have the following
I'm learning Javascript (mainly using JQuery) and was wondering if somebody could help me.
I was wondering if somebody could help me with this, I've seen a few
I was wondering if somebody could help me with how exactly to write some
Wondering if someone could help me. I have next to no knowledge with Ajax,
Hi guys just wondering if somebody could help me try and correctly thread my
I was wondering if somebody could help me, I can do it on pen
I was wondering if somebody could shed some light on this browser behaviour: I

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.