Categories
JQuery

Addition of Three Numbers in JQuery

I  wrote this simple program that I wrote using JQuery a JavaScript library to ask the user to give three numbers and then the program will sum the values of three numbers and display the results on the screen.
I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.


Here in Bacolod City, Negros Occidental I also accepting computer repair, web development using WordPress, Computer Networking and Arduino Project development at a very affordable price.
My personal website is http://www.jakerpomperada.com

My programming website is http://www.jakerpomperada.blogspot.com

I am also a book author you can purchase my books on computer programming and information technology in the following links below.
https://www.mindshaperspublishing.com/
https://www.unlimitedbooksph.com/

Sample Program Output
Sample Program Output
Program Listing

index.htm

<!doctype html>
<html>
<head>
     <script type='text/javascript' src='jquery/jquery.min.js'></script>
   <script type='text/javascript' src='add.js'></script>
</head>
<body>
 <h2> Addition of Three Numbers in JQuery </h2>
    <h4><i> Author Jake R. Pomperada,MAED-IT </i></h4>
 <br>
Enter the First number : <input id="first"><br>
Enter the Second number: <input id="second"><br>
Enter the Third number: <input id="third"><br><br>
The total sum is <input id="answer"><br><br>
<button id="btnAdd">Add</button>
<button id="btnClear">Clear</button>

</body>
</html>

add.js

// Code By Jake R. Pomperada,MAED-IT
// February 25, 2020

$(document).ready(function(){

$("#btnAdd").click(function(){
  var a,b,c;
a=Number(document.getElementById("first").value);
b=Number(document.getElementById("second").value);
c=Number(document.getElementById("third").value);
d= a + b+c;
document.getElementById("answer").value= d;

});



$("#btnClear").click(function(){

 document.getElementById('first').value="";
 document.getElementById('second').value="";
 document.getElementById('third').value="";
 document.getElementById('answer').value="";
 document.getElementById('first').focus();

});
});

Leave a Reply

Your email address will not be published. Required fields are marked *