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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:10:29+00:00 2026-06-12T05:10:29+00:00

I have made a small application on a school. Where there is a dropdown

  • 0

I have made a small application on a school. Where there is a dropdown field. In that dropdown I have all the students name and there are also 4 remaining input fields. where the input fields will have values for marks like marks in physics, chemistry, maths and the last one will make the total and that will be addition of marks in physics+chemistry+maths.
Now I have used some ajax and jquery tricks and have done some changes like when one student name will be selected from the dropdown box it will show the mark for that particular student in physics, chemistry, maths. Now I want that the marks for physics, chemistry, maths will be added and will be sum in total field. For that I have written jQuery like this

  <script type="text/javascript">
  jQuery(document).ready(function(){
    jQuery('#student_name').on('change',function(event){
    var totalmarks = jQuery("#marks_physics").val() + jQuery("#marks_chemistry").val()+ jQuery("#marks_chemistry");
    jQuery("#marks_total").val(totalmarks);
  });
});
</script>

Here id student_name is the dropdown field for the students name and id marks_total is the field name where the total mark should show after addition. Now my problem is that it is showing the marks of that student when once the name has been changed in that drop down.
Suppose I have two students named as A and B. When once A is selected it is showing nothing but as I am selecting B from the dropdown it is showing the values of A.I had also used select in place of change but its not working there. So can someone tell me how to solve this. Any help and suggestions will be highly appreciable. Thanks in advance.

UPDATE

Actually it is showing the actual values of that field but when I tried the console tab to see the value of that field as console.log(#marks_physics) it is showing the previous value for that field and also in place of total it is showing the previous entered total marks value.

  • 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-12T05:10:30+00:00Added an answer on June 12, 2026 at 5:10 am

    Try this

    <script type="text/javascript">
      jQuery(document).ready(function(){
        jQuery('#student_name').ajaxComplete(function(event,request,settings){
        var totalmarks = jQuery("#marks_physics").val() + jQuery("#marks_chemistry").val()+ jQuery("#marks_chemistry");
        jQuery("#marks_total").val(totalmarks);
      });
    });
    </script>
    

    Now you can alert your actual entered values as console.log(#marks_physics) and it will show you the right one.

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

Sidebar

Related Questions

I have written a small WinForm application in C#. The EXE that is made
I have made a small method to display the installed application name in android.
I have made a small java swing application that I want to share with
I have made a small application in Java and I would like to make
I have made a small log service that i want to publish to a
I have made a small windows application with visual studio 2008 ,its working properly
I have made a small application in Windows Azure. For research purposes they asked
I have made a small Java .jar GUI application. When I run it on
I have made a small swing application for my personal use. This app connects
I have a small application that runs on fairly recent Linux distributions with Python

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.