4 thoughts on “jQuery Sum & Subtract Two Input Fields

  1. Hi, I think the function sum() can be rewritten as follows:
    function sum(){

    Also, $(“#num1, #num2”).on(“keydown keyup”, function() {
    can be rewritten as $(“#num1, #num2”).on(“keydown keyup”,sum);


  2. Thanks for your input Deepak, i would appreciate if you write your code in Code block.
    For example like this:

    $(document).ready(function() {
        //this calculates values automatically 
        $("#num1, #num2").on("keydown keyup",sum);
    function sum(){

    For your convenience you can check code block format here

    Or leave a jsfiddle.net working demo link, as i provided above in my tutorial.🙂

    Liked by 1 person

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s