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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:43:28+00:00 2026-06-10T02:43:28+00:00

I have a simple script i wrote to count how many tick boxes are

  • 0

I have a simple script i wrote to count how many tick boxes are ticked and show/hide content for them. It works fine in some browsers but even testing 2 macs with FF as well both return different. ie. if no boxes it would return laggard, more than this is should change the div on display.

The odd thing is, some browsers are reversing this, e.g. if all the boxes are ticked it shows laggard instead of innovator.

Any ideas?

<script type="text/javascript">
$(document).ready(function() {
$('input[type=checkbox]').change(function() {
//alert($('input:checked').size())
//if laggard
if ($('input:checked').size() < 1) {
$("div#four").show();
$("div#one").hide();
$("div#two").hide();
$("div#three").hide();
$("div#EM").hide();
}
//late majority
else if ($('input:checked').size() < 2) {
$("div#three").show();
$("div#one").hide();
$("div#two").hide();
$("div#four").hide();
$("div#EM").hide();
}
// early majority
else if ($('input:checked').size() < 4) {
$("div#two").hide();
$("div#one").hide();
$("div#three").hide();
$("div#four").hide();
$("div#EM").show();
}
// early adopter
else if ($('input:checked').size() < 6) {
$("div#two").show();
$("div#one").hide();
$("div#three").hide();
$("div#four").hide();
$("div#EM").hide();
}
else if ($('input:checked').size() < 7) {
$("div#one").show();
$("div#two").hide();
$("div#three").hide();
$("div#four").hide();
$("div#EM").hide();
}
   else {
  // do something here
$("div#four").show();
 $("div#one").hide();
 $("div#two").hide();
 $("div#three").hide();
 $("div#EM").hide();

}
});   
   $('#showMore').click(function() {
  $('#answer').show('slow', function() {
  });
});

    });

</script>
  • 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-10T02:43:29+00:00Added an answer on June 10, 2026 at 2:43 am

    The only reason why Laggard would show up when all checkboxes are clicked is that you have 7 or more checkboxes. I created a jsfiddle here.

    http://jsfiddle.net/wirey00/a3Tx8/

    Also, Here’s a shorter way to write your code

    $('input[type=checkbox]').change(function() {
        var len = $('input:checked').length;  
        $('#four').toggle(len<1 || len > 6);
        $('#three').toggle(len==1);
        $('#two').toggle(len==4 || len==5);
        $('#one').toggle(len==6);
        $('#EM').toggle(len==2 || len==3);
    });​
    

    Using .toggle() allows for you to pass in a condition(true/false) which determines if it is shown(true) or hidden(false)

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

Sidebar

Related Questions

I have a simple script to check how many files a user has uploaded:
I have been using this simple script to generate images from text: <?php header('Content-type:
I have wrote a simple php script which reads an IMAP email account and
I have simple script with EventMachine, Fibers and faye require faye require em-synchrony require
I have a simple script of code that reads a PHP file and when
I have this simple script that I'm working on. I must admit, I'm totally
I have a simple script, which tries to kill an already running process. I
I have a simple script that does some search and replace. This is basically
I have a simple script that pulls about 100 million results, 1 million at
OK I have a simple script at http://kleague.org/test/ Type a movie name and it

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.