How to add the two input number using Jquery ?


So many time while working with Jquery, you will think, how can i do the summation of two number using Jquery. Here is the simple syntax for doing this task.

<!DOCTYPE html>
<html xmlns="">
    <script src="../../Scripts/jquery.min.js"></script>
        $(function () {
            $("#btnSum").click(function () {
                 var res = (parseInt($("#Num1").val()) + parseInt($("#Num2").val()));
   Num1: <input type="text" name="Num1" id="Num1" value="" />
    <br />
    Num2 :<input type="text" name="Num2" id="Num2" value="" />
    <br />
    <button id="btnSum">Click Here</button>

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.