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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:20:01+00:00 2026-05-29T06:20:01+00:00

I have an application here . When you open the application then please type

  • 0

I have an application here. When you open the application then please type in a number in the textbox and click on the “Add question” button. This will add a new row and it will do a calculation between total session marks remaining and then number you have entered.

What I want to know if that how do I display in my alert that that if (‘#total-weight’) does not equal 0, then display an alert stating:

Your Total Session Marks Remaining does not equal 0.

You have '' marks remaining  //this is if total session marks is above 0

OR

You need to remove '' marks  // this is if total session marks is below 0

Below is code which does the subtraction:

var totalmarks = '10';

$(document).ready(function()

{

$('#total-weight').html(totalmarks);

    $(document).on('change', '#qandatbl td.weight input', calculateTotal);

});

function calculateTotal()
{
   var totalweight = totalmarks;
   $("#qandatbl td.weight input").each(function (i, elm){
        totalweight = totalweight - Number($(elm).val(), 10);
    });

    $("#total-weight").text(totalweight);
}

Below is the validation code where all the other alerts appear:

function validation() {

    var _qid = "";
    var _msg = "";

    var alertValidation = "";
    // Note, this is just so it's declared...
    $("tr.optionAndAnswer").each(function() {


        _qid = $("td.qid",this).text();
        _msg = "You have errors on Question Number: " + _qid + "\n";


        $(".txtWeightRow",this).each(function() {


            if (!this.value) {
                alertValidation += "\n\u2022 Please enter in a figure for Number of Marks for this Question\n";
            }

            if (alertValidation != "") {
                return false; //Stop the each loop 
            }
        });

        if(alertValidation != ""){
            return false;
        }
    });

    if (alertValidation != "") {
        alert(_msg + alertValidation);
        return false;
    }

    return true;
}

I only want this alert to appear when all the rows do not contain any errors. Can this be done?

  • 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-29T06:20:02+00:00Added an answer on May 29, 2026 at 6:20 am

    Try something like this:

    http://jsfiddle.net/FVjp3/1/

    This will display a message just like you wanted based on the number of marks in #total-marks.

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

Sidebar

Related Questions

I have an application you can access here When you open the app, please
I have an application here When you open the application, please keep clicking on
here is a good question: I have an application compiled for iPhone OS 2.21.
I have a question here regarding iPhone app submission. I have a free application
Here's my first question at SO. I have a internal application for my company
This is my first time asking a question, please be gentle! I have a
I have a Flex application here If you open that link, you'll see it
I have a problem with my application which is here . Please follow steps
I have a problem with my application which is here . Please follow steps
I have an application here I have 2 questions: Question 1: How do 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.