Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Addition of Two Numbers Using jQuery

In this Jquery program, I am going to share the addition of two numbers using jQuery. This is a very easy and simple program written in jQuery to calculate any two numbers.

Addition of Two Numbers Using jQuery

Create an index.html file and include the jQuery file before head tag closed.


Copy paste below jQuery code inside the head tag.

$(document).ready(function(){
      $("#calculate").click(function () {
      var num1 = $("#num1").val();
      var num2 = $("#num2").val();
      var answer = parseInt(num1) + parseInt(num2);
      alert(answer);
      $("#answer").val(answer);
    });
  });

Now copy the below HTML code and add to the index.html file inside the body tag.

Now open the index.html page in your browser and execute the program to see the output. Below is the complet code this program.

  
    Addition of Two Numbers Using jQuery
  

See DEMO here,

See the live demo of above program by clicking on below Try it Yourself button.

Try it Yourself

The post Addition of Two Numbers Using jQuery appeared first on FreeWebMentor.



This post first appeared on Programming Blog Focused On Web Technologies, please read the originial post: here

Share the post

Addition of Two Numbers Using jQuery

×

Subscribe to Programming Blog Focused On Web Technologies

Get updates delivered right to your inbox!

Thank you for your subscription

×