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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:10:15+00:00 2026-06-10T19:10:15+00:00

The explanation is below the code: The code for HTML is : <div id=container><h1>Add-ons</h1>

  • 0

The explanation is below the code:

The code for HTML is :

<div id="container"><h1>Add-ons</h1>
<input type="checkbox" name="ch1" value="10" id="qr1" />Add-on Number 1 - 10 QR <br />
<input type="checkbox" name="ch1" value="20" id="qr1" />Add-on Number 2 - 20 QR <br />
<input type="checkbox" name="ch1" value="40" id="qr1" />Add-on Number 3 - 40 QR <br />
<input type="checkbox" name="ch1" value="60" id="qr1" />Add-on Number 4 - 60 QR <br />
</div>

<div> I want more add-ons
<select id="more" name="more">
    <option value="0 QR">0</option>
    <option value="30 QR">1</option>
    <option value="50 QR">2</option>
    <option value="100 QR">3</option>
</select>
<span id="span"></span>
 User total usage: <span id="usertotal"> </span>

jQuery:

//For select          

function displayVals() {
  var singleValues = $("#more").val();         
  $("#span").html("<b>more addons:</b> " + 
    singleValues);
}

$("select").change(displayVals);
displayVals();

//For  checkboxes
var $cbs = $('input[name="ch1"]');
$cbs.click(function() {
  var total = 0;
  $cbs.each(function() {
    if (this.checked)
      var singleValues = $("#more").val();
      total += +this.value + singleValues;
  });
  $("#usertotal").text(total);
});

I want the user total usage: to create the sum of the checkboxes and add the value of the option so that if I select checkbox 1 and 2 plus option 1 I will have written in user total usage: 60.

  • 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-10T19:10:17+00:00Added an answer on June 10, 2026 at 7:10 pm

    I’ve created a fiddle for your code.

    Hope this is what you wanted.

    HTML:

    <div id="container"><h1>Add-ons</h1>
    <input type="checkbox" name="ch1" value="10" id="qr1" />Add-on Number 1 - 10 QR <br />
    <input type="checkbox" name="ch1" value="20" id="qr1" />Add-on Number 2 - 20 QR <br />
    <input type="checkbox" name="ch1" value="40" id="qr1" />Add-on Number 3 - 40 QR <br />
    <input type="checkbox" name="ch1" value="60" id="qr1" />Add-on Number 4 - 60 QR <br />
    </div>
    
    <div> I want more add-ons
    <select id="more" name="more">
        <option value="0">0</option>
        <option value="30">1</option>
        <option value="50">2</option>
        <option value="100">3</option>
    </select>
    <span id="span"></span>
     User total usage: <span id="usertotal"> </span>
    

    Javascript:

    function displayVals() {
          calcUsage();
          var singleValues = $("#more").val();         
          $("#span").html("<b>more addons:</b> " + 
                      singleValues + ' QR');
    }
    var $cbs = $('input[name="ch1"]');
    function calcUsage() {
        var total = $("#more").val();
        $cbs.each(function() {
            if (this.checked)
                total = parseInt(total) + parseInt(this.value);
        });
        $("#usertotal").text(total + ' QR');
    }
    
        $("select").change(displayVals);
        displayVals();
    //For  checkboxes
    
    $cbs.click(calcUsage);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

my html code is like below : <div id=FormMessages> <div id=user-info-message class=error> <asp:Image ID=imgError1
Can anyone explain the below code can any one give some real time explanation
My explanation below rambles, boiling down, is there a way I can add a
In the example code below could someone walk through a more detailed explanation of
The below code is taken from http://bonsaiden.github.com/JavaScript-Garden/ function Foo() { this.value = 42; }
I have a problem for querying records into mysql explanation below The user could
I want to add explanation between cells. I'm experimenting with sections, trying to make
Drawing more than ~5+ SVG lines with the code below makes performance choppy when
I have a problem understanding what's causes the compilation error in the code below:
VS2010 has supported the C++11 partially. I compile the code below in VS2010 RTM.

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.