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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:48:08+00:00 2026-05-27T23:48:08+00:00

So I have this code: HTML <input type=checkbox class=checkbox /> <input type=checkbox class=checkbox />

  • 0

So I have this code:

HTML

<input type=checkbox class="checkbox" />
<input type=checkbox class="checkbox" />
<input type=checkbox class="checkbox" />
<input type=checkbox class="checkbox" />

<div class="number">
    hello
</div>

JS

var increment2 = 1;
$('.checkbox').live('click', function() {
    $('.number').html( '(' + increment2 + ')');
    increment2++;
})

http://jsfiddle.net/P3zMu/5/

It increments the number when checkbox is clicked, as can be seen in the example. The issue is to increase the number when checkbox is checked and decrease when the checkbox is unchecked. Will be very greatful for any help.

  • 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-05-27T23:48:08+00:00Added an answer on May 27, 2026 at 11:48 pm

    Hi that’s your solution: https://jsfiddle.net/P3zMu/254/

    HTML

    <input type=checkbox class="checkbox" />
    <input type=checkbox class="checkbox" />
    <input type=checkbox class="checkbox" />
    <input type=checkbox class="checkbox" />
    
    <div class="number">
        hello
    </div>
    

    JS

    var increment2=0; 
    $('.checkbox').on('click', function() { 
        if (this.checked) {
            increment2++;                 
        } else {
            increment2--;
        }
        $('.number').html( '(' + increment2 + ')');             
    })
    

    Best regards!

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

Sidebar

Related Questions

I have this html; <div class=AttachmentContainer> <div class=display-label>Attachment name</div> <div class=display-field> <input type=checkbox id=chkAttachment
I have several like this in my HTML code: <input class=table type=checkbox name=interest[] value=finger
I have html like this: <div> <input type=checkbox id=checkbox, checked=checked/> <label for=checkbox>Copy values</label> </div>
Hi i have this html code: <input type=checkbox id=button2> <label for=button2>something here</label> So the
I have some HTML code like this: <input id=fieldname-1 name=field_name[value][1] value=1 type=checkbox /> <input
I have this HTML code for radios: <input type='radio' name='a_27' value='Yes' id='a_27_0' /> <input
I have this HTML code: <div class='com_box'> <div class='com_box_c'> <div class='com_box_info'> <a id='quote'>quote</a> </div>
i have this code $(function() { $('#ans_vote a span').click(function(){alert('working');return false;});}); and this html <div
I have the following HTML code: <input type=checkbox value=1 /> <input type=checkbox value=2 />
I have the following code in my html: <li> <p> <input type=checkbox id=is_selected/> <img

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.