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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:16:49+00:00 2026-06-09T01:16:49+00:00

I’m having bug complications in my code. I’ve been researching for a few hours

  • 0

I’m having bug complications in my code. I’ve been researching for a few hours now for a solution. Here’s what I’m trying to achieve:

I have a page with 6 checkboxes. There is a wrapping div .control-case around each checkbox. If 5 checkboxes are checked, the remaining checkbox’s .control-case will have a class added .unselected.

NOW, if this wrapper .control-case .unselected is clicked, then I have a notice span that I want to be animated with jQuery color.

Good news: It somewhat works when it’s clicked.

Bad News: It sometimes triggers div’s without the class every now-and-then and it may also repeat the color changes (I assume due to a queue backup). How do I only allow it to be triggered once on the correct div ONLY when clicked?

P.S. I’ve also tried the .hasClass method. No success.

Here’s my Code:
http://pastebin.com/8XR7iHp2

I appreciate all your support! 🙂

  • 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-09T01:16:51+00:00Added an answer on June 9, 2026 at 1:16 am

    Each time you run this code,

    $('#type-controls .control-case.unselected').click(function() {
    

    A new click handler is actually added to your code. Thus, causing the repeat firing. I have rewritten your code using another method. See if it fulfills your requirement.

        $(document).ready(function() {
            $('input:checkbox#foam-control, input:checkbox#reversecurve-control, input:checkbox#ultra-control, input:checkbox#pro-control, input:checkbox#icebreaker-control').attr('checked', true);
            $("#type-controls input[type=checkbox]").click(function() {
                var countchecked = $("#type-controls input[type=checkbox]:checked").length;
                if (countchecked >= 5) {
                    $('#type-controls input[type=checkbox]').not(':checked').attr("disabled", true);
                }
                else {
                    $('#type-controls input[type=checkbox]').not(':checked').attr("disabled", false);
                }
            });
    
            $("#type-controls label").click(function() {
                var countchecked = $("#type-controls input[type=checkbox]:checked").length;
                if (countchecked >= 5 && $(this).parent().hasClass('unselected')) {
                    alert("Do notice");
                    $('.max-notice').animate({
                        'backgroundColor': '#c30c08',
                        'color': '#fff'
                    }, 400).delay(3000).animate({
                        'backgroundColor': '#fff',
                        'color': '#777'
                    }, 300);
                }
            });
        });​
    

    You can view the demo at http://jsfiddle.net/w7djF/1/

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to loop through a bunch of documents I have to put
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and

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.