How can i plus a integer value after get sum result using jquery?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















Actually, I want to get integer value this is working when i'm inserting value suppose i insert value 4+5 in input then I'm getting it in my result then I'm gettting it in another div with result like if I get 4+5 then it should be 9.



But i'm getting [object Object]



What is wrong in my code?






$(document).ready(function(){

$('button').click(function(){
var oldValue;
var getValue;
var boxValue;

oldValue = $('.box').text();
getValue = $('.getValue').val();
boxValue = $('.box').text(oldValue + getValue);

$('.finalResult').text(boxValue);
});
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button>Button</button>
<input type="text" class="getValue">

<div class="box"></div>
<div class="finalResult"></div>












share|improve this question























  • $('.finalResult').text(oldValue + getValue) should solve

    – Medet Tleukabiluly
    Nov 16 '18 at 13:56











  • What's the value of oldValue? What it is holding and what is its type?

    – Zainul Abideen
    Nov 16 '18 at 14:03











  • So you are setting text() with a jQuery object!

    – epascarello
    Nov 16 '18 at 14:18











  • @Medet Tleukabiluly i'm getting same value on both result.

    – Rohit Verma
    Nov 16 '18 at 16:06


















0















Actually, I want to get integer value this is working when i'm inserting value suppose i insert value 4+5 in input then I'm getting it in my result then I'm gettting it in another div with result like if I get 4+5 then it should be 9.



But i'm getting [object Object]



What is wrong in my code?






$(document).ready(function(){

$('button').click(function(){
var oldValue;
var getValue;
var boxValue;

oldValue = $('.box').text();
getValue = $('.getValue').val();
boxValue = $('.box').text(oldValue + getValue);

$('.finalResult').text(boxValue);
});
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button>Button</button>
<input type="text" class="getValue">

<div class="box"></div>
<div class="finalResult"></div>












share|improve this question























  • $('.finalResult').text(oldValue + getValue) should solve

    – Medet Tleukabiluly
    Nov 16 '18 at 13:56











  • What's the value of oldValue? What it is holding and what is its type?

    – Zainul Abideen
    Nov 16 '18 at 14:03











  • So you are setting text() with a jQuery object!

    – epascarello
    Nov 16 '18 at 14:18











  • @Medet Tleukabiluly i'm getting same value on both result.

    – Rohit Verma
    Nov 16 '18 at 16:06














0












0








0








Actually, I want to get integer value this is working when i'm inserting value suppose i insert value 4+5 in input then I'm getting it in my result then I'm gettting it in another div with result like if I get 4+5 then it should be 9.



But i'm getting [object Object]



What is wrong in my code?






$(document).ready(function(){

$('button').click(function(){
var oldValue;
var getValue;
var boxValue;

oldValue = $('.box').text();
getValue = $('.getValue').val();
boxValue = $('.box').text(oldValue + getValue);

$('.finalResult').text(boxValue);
});
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button>Button</button>
<input type="text" class="getValue">

<div class="box"></div>
<div class="finalResult"></div>












share|improve this question














Actually, I want to get integer value this is working when i'm inserting value suppose i insert value 4+5 in input then I'm getting it in my result then I'm gettting it in another div with result like if I get 4+5 then it should be 9.



But i'm getting [object Object]



What is wrong in my code?






$(document).ready(function(){

$('button').click(function(){
var oldValue;
var getValue;
var boxValue;

oldValue = $('.box').text();
getValue = $('.getValue').val();
boxValue = $('.box').text(oldValue + getValue);

$('.finalResult').text(boxValue);
});
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button>Button</button>
<input type="text" class="getValue">

<div class="box"></div>
<div class="finalResult"></div>








$(document).ready(function(){

$('button').click(function(){
var oldValue;
var getValue;
var boxValue;

oldValue = $('.box').text();
getValue = $('.getValue').val();
boxValue = $('.box').text(oldValue + getValue);

$('.finalResult').text(boxValue);
});
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button>Button</button>
<input type="text" class="getValue">

<div class="box"></div>
<div class="finalResult"></div>





$(document).ready(function(){

$('button').click(function(){
var oldValue;
var getValue;
var boxValue;

oldValue = $('.box').text();
getValue = $('.getValue').val();
boxValue = $('.box').text(oldValue + getValue);

$('.finalResult').text(boxValue);
});
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button>Button</button>
<input type="text" class="getValue">

<div class="box"></div>
<div class="finalResult"></div>






javascript jquery






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 16 '18 at 13:55









Rohit VermaRohit Verma

1,63221126




1,63221126













  • $('.finalResult').text(oldValue + getValue) should solve

    – Medet Tleukabiluly
    Nov 16 '18 at 13:56











  • What's the value of oldValue? What it is holding and what is its type?

    – Zainul Abideen
    Nov 16 '18 at 14:03











  • So you are setting text() with a jQuery object!

    – epascarello
    Nov 16 '18 at 14:18











  • @Medet Tleukabiluly i'm getting same value on both result.

    – Rohit Verma
    Nov 16 '18 at 16:06



















  • $('.finalResult').text(oldValue + getValue) should solve

    – Medet Tleukabiluly
    Nov 16 '18 at 13:56











  • What's the value of oldValue? What it is holding and what is its type?

    – Zainul Abideen
    Nov 16 '18 at 14:03











  • So you are setting text() with a jQuery object!

    – epascarello
    Nov 16 '18 at 14:18











  • @Medet Tleukabiluly i'm getting same value on both result.

    – Rohit Verma
    Nov 16 '18 at 16:06

















$('.finalResult').text(oldValue + getValue) should solve

– Medet Tleukabiluly
Nov 16 '18 at 13:56





$('.finalResult').text(oldValue + getValue) should solve

– Medet Tleukabiluly
Nov 16 '18 at 13:56













What's the value of oldValue? What it is holding and what is its type?

– Zainul Abideen
Nov 16 '18 at 14:03





What's the value of oldValue? What it is holding and what is its type?

– Zainul Abideen
Nov 16 '18 at 14:03













So you are setting text() with a jQuery object!

– epascarello
Nov 16 '18 at 14:18





So you are setting text() with a jQuery object!

– epascarello
Nov 16 '18 at 14:18













@Medet Tleukabiluly i'm getting same value on both result.

– Rohit Verma
Nov 16 '18 at 16:06





@Medet Tleukabiluly i'm getting same value on both result.

– Rohit Verma
Nov 16 '18 at 16:06












4 Answers
4






active

oldest

votes


















2

















$(document).ready(function(){

$('button').click(function(){
var oldValue;
var getValue;
var boxValue;

oldValue = $('.box').text();
getValue = $('.getValue').val();
boxValue = $('.box').text(oldValue + getValue);

$('.finalResult').text(Number(oldValue || '0') + eval(getValue));
});
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button>Button</button>
<input type="text" class="getValue">

<div class="box"></div>
<div class="finalResult"></div>








share|improve this answer
























  • your code is working fine but what use of eval() in this code?

    – Rohit Verma
    Nov 16 '18 at 16:15



















0

















$(document).ready(function(){

$('button').click(function(){
var oldValue;
var getValue;
var boxValue;

oldValue = $('.box').text();
getValue = $('.getValue').val();
if(!isNaN(oldValue) && !isNaN(getValue) )
{
boxValue = $('.box').text(oldValue + getValue);// in this line you are setting a value and assignig it to boxValue
$('.finalResult').text(boxValue.text());//I am replacing this line
}
});
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button>Button</button>
<input type="text" class="getValue">

<div class="box">0</div>
<div class="finalResult"></div>




see this fiddle




share|improve this answer































    0














    I'm not quite sure what your ultimate goal is, but the [Object Object] occurs because you are placing the jQuery representation of .box into the DOM, which is an object.



    Try changing these lines ...



        oldValue = +$('.box').text() || 0;
    getValue = +$('.getValue').val();

    $('.finalResult').text(boxValue.text());


    The first two lines are one way to ensure you have a number; the last places the correct "text".






    share|improve this answer































      0














      You are getting [objec object] because you are actually trying to set an object in the div, below see the problem line. What you are doing is that you calculate the some and set the result .finalResult div but you are actually assigning the div to a variable and jquery is treating that variable as an object



      $(document).ready(function(){

      $('button').click(function(){
      var oldValue;
      var getValue;
      var boxValue;

      oldValue = $('.box').text();
      getValue = $('.getValue').val();
      boxValue = $('.box').text(oldValue + getValue); //<-- problem

      $('.finalResult').text(boxValue);
      });
      });


      change the following line



      $('.finalResult').text(boxValue);


      with this one



      $('.finalResult').text(boxValue.text());





      share|improve this answer
























        Your Answer






        StackExchange.ifUsing("editor", function () {
        StackExchange.using("externalEditor", function () {
        StackExchange.using("snippets", function () {
        StackExchange.snippets.init();
        });
        });
        }, "code-snippets");

        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "1"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53339247%2fhow-can-i-plus-a-integer-value-after-get-sum-result-using-jquery%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        4 Answers
        4






        active

        oldest

        votes








        4 Answers
        4






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        2

















        $(document).ready(function(){

        $('button').click(function(){
        var oldValue;
        var getValue;
        var boxValue;

        oldValue = $('.box').text();
        getValue = $('.getValue').val();
        boxValue = $('.box').text(oldValue + getValue);

        $('.finalResult').text(Number(oldValue || '0') + eval(getValue));
        });
        });

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
        <button>Button</button>
        <input type="text" class="getValue">

        <div class="box"></div>
        <div class="finalResult"></div>








        share|improve this answer
























        • your code is working fine but what use of eval() in this code?

          – Rohit Verma
          Nov 16 '18 at 16:15
















        2

















        $(document).ready(function(){

        $('button').click(function(){
        var oldValue;
        var getValue;
        var boxValue;

        oldValue = $('.box').text();
        getValue = $('.getValue').val();
        boxValue = $('.box').text(oldValue + getValue);

        $('.finalResult').text(Number(oldValue || '0') + eval(getValue));
        });
        });

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
        <button>Button</button>
        <input type="text" class="getValue">

        <div class="box"></div>
        <div class="finalResult"></div>








        share|improve this answer
























        • your code is working fine but what use of eval() in this code?

          – Rohit Verma
          Nov 16 '18 at 16:15














        2












        2








        2










        $(document).ready(function(){

        $('button').click(function(){
        var oldValue;
        var getValue;
        var boxValue;

        oldValue = $('.box').text();
        getValue = $('.getValue').val();
        boxValue = $('.box').text(oldValue + getValue);

        $('.finalResult').text(Number(oldValue || '0') + eval(getValue));
        });
        });

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
        <button>Button</button>
        <input type="text" class="getValue">

        <div class="box"></div>
        <div class="finalResult"></div>








        share|improve this answer
















        $(document).ready(function(){

        $('button').click(function(){
        var oldValue;
        var getValue;
        var boxValue;

        oldValue = $('.box').text();
        getValue = $('.getValue').val();
        boxValue = $('.box').text(oldValue + getValue);

        $('.finalResult').text(Number(oldValue || '0') + eval(getValue));
        });
        });

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
        <button>Button</button>
        <input type="text" class="getValue">

        <div class="box"></div>
        <div class="finalResult"></div>








        $(document).ready(function(){

        $('button').click(function(){
        var oldValue;
        var getValue;
        var boxValue;

        oldValue = $('.box').text();
        getValue = $('.getValue').val();
        boxValue = $('.box').text(oldValue + getValue);

        $('.finalResult').text(Number(oldValue || '0') + eval(getValue));
        });
        });

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
        <button>Button</button>
        <input type="text" class="getValue">

        <div class="box"></div>
        <div class="finalResult"></div>





        $(document).ready(function(){

        $('button').click(function(){
        var oldValue;
        var getValue;
        var boxValue;

        oldValue = $('.box').text();
        getValue = $('.getValue').val();
        boxValue = $('.box').text(oldValue + getValue);

        $('.finalResult').text(Number(oldValue || '0') + eval(getValue));
        });
        });

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
        <button>Button</button>
        <input type="text" class="getValue">

        <div class="box"></div>
        <div class="finalResult"></div>






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 16 '18 at 14:03









        Medet TleukabilulyMedet Tleukabiluly

        6,47522246




        6,47522246













        • your code is working fine but what use of eval() in this code?

          – Rohit Verma
          Nov 16 '18 at 16:15



















        • your code is working fine but what use of eval() in this code?

          – Rohit Verma
          Nov 16 '18 at 16:15

















        your code is working fine but what use of eval() in this code?

        – Rohit Verma
        Nov 16 '18 at 16:15





        your code is working fine but what use of eval() in this code?

        – Rohit Verma
        Nov 16 '18 at 16:15













        0

















        $(document).ready(function(){

        $('button').click(function(){
        var oldValue;
        var getValue;
        var boxValue;

        oldValue = $('.box').text();
        getValue = $('.getValue').val();
        if(!isNaN(oldValue) && !isNaN(getValue) )
        {
        boxValue = $('.box').text(oldValue + getValue);// in this line you are setting a value and assignig it to boxValue
        $('.finalResult').text(boxValue.text());//I am replacing this line
        }
        });
        });

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
        <button>Button</button>
        <input type="text" class="getValue">

        <div class="box">0</div>
        <div class="finalResult"></div>




        see this fiddle




        share|improve this answer




























          0

















          $(document).ready(function(){

          $('button').click(function(){
          var oldValue;
          var getValue;
          var boxValue;

          oldValue = $('.box').text();
          getValue = $('.getValue').val();
          if(!isNaN(oldValue) && !isNaN(getValue) )
          {
          boxValue = $('.box').text(oldValue + getValue);// in this line you are setting a value and assignig it to boxValue
          $('.finalResult').text(boxValue.text());//I am replacing this line
          }
          });
          });

          <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
          <button>Button</button>
          <input type="text" class="getValue">

          <div class="box">0</div>
          <div class="finalResult"></div>




          see this fiddle




          share|improve this answer


























            0












            0








            0










            $(document).ready(function(){

            $('button').click(function(){
            var oldValue;
            var getValue;
            var boxValue;

            oldValue = $('.box').text();
            getValue = $('.getValue').val();
            if(!isNaN(oldValue) && !isNaN(getValue) )
            {
            boxValue = $('.box').text(oldValue + getValue);// in this line you are setting a value and assignig it to boxValue
            $('.finalResult').text(boxValue.text());//I am replacing this line
            }
            });
            });

            <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
            <button>Button</button>
            <input type="text" class="getValue">

            <div class="box">0</div>
            <div class="finalResult"></div>




            see this fiddle




            share|improve this answer
















            $(document).ready(function(){

            $('button').click(function(){
            var oldValue;
            var getValue;
            var boxValue;

            oldValue = $('.box').text();
            getValue = $('.getValue').val();
            if(!isNaN(oldValue) && !isNaN(getValue) )
            {
            boxValue = $('.box').text(oldValue + getValue);// in this line you are setting a value and assignig it to boxValue
            $('.finalResult').text(boxValue.text());//I am replacing this line
            }
            });
            });

            <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
            <button>Button</button>
            <input type="text" class="getValue">

            <div class="box">0</div>
            <div class="finalResult"></div>




            see this fiddle




            $(document).ready(function(){

            $('button').click(function(){
            var oldValue;
            var getValue;
            var boxValue;

            oldValue = $('.box').text();
            getValue = $('.getValue').val();
            if(!isNaN(oldValue) && !isNaN(getValue) )
            {
            boxValue = $('.box').text(oldValue + getValue);// in this line you are setting a value and assignig it to boxValue
            $('.finalResult').text(boxValue.text());//I am replacing this line
            }
            });
            });

            <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
            <button>Button</button>
            <input type="text" class="getValue">

            <div class="box">0</div>
            <div class="finalResult"></div>





            $(document).ready(function(){

            $('button').click(function(){
            var oldValue;
            var getValue;
            var boxValue;

            oldValue = $('.box').text();
            getValue = $('.getValue').val();
            if(!isNaN(oldValue) && !isNaN(getValue) )
            {
            boxValue = $('.box').text(oldValue + getValue);// in this line you are setting a value and assignig it to boxValue
            $('.finalResult').text(boxValue.text());//I am replacing this line
            }
            });
            });

            <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
            <button>Button</button>
            <input type="text" class="getValue">

            <div class="box">0</div>
            <div class="finalResult"></div>






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 16 '18 at 14:04









            Negi RoxNegi Rox

            1,9141512




            1,9141512























                0














                I'm not quite sure what your ultimate goal is, but the [Object Object] occurs because you are placing the jQuery representation of .box into the DOM, which is an object.



                Try changing these lines ...



                    oldValue = +$('.box').text() || 0;
                getValue = +$('.getValue').val();

                $('.finalResult').text(boxValue.text());


                The first two lines are one way to ensure you have a number; the last places the correct "text".






                share|improve this answer




























                  0














                  I'm not quite sure what your ultimate goal is, but the [Object Object] occurs because you are placing the jQuery representation of .box into the DOM, which is an object.



                  Try changing these lines ...



                      oldValue = +$('.box').text() || 0;
                  getValue = +$('.getValue').val();

                  $('.finalResult').text(boxValue.text());


                  The first two lines are one way to ensure you have a number; the last places the correct "text".






                  share|improve this answer


























                    0












                    0








                    0







                    I'm not quite sure what your ultimate goal is, but the [Object Object] occurs because you are placing the jQuery representation of .box into the DOM, which is an object.



                    Try changing these lines ...



                        oldValue = +$('.box').text() || 0;
                    getValue = +$('.getValue').val();

                    $('.finalResult').text(boxValue.text());


                    The first two lines are one way to ensure you have a number; the last places the correct "text".






                    share|improve this answer













                    I'm not quite sure what your ultimate goal is, but the [Object Object] occurs because you are placing the jQuery representation of .box into the DOM, which is an object.



                    Try changing these lines ...



                        oldValue = +$('.box').text() || 0;
                    getValue = +$('.getValue').val();

                    $('.finalResult').text(boxValue.text());


                    The first two lines are one way to ensure you have a number; the last places the correct "text".







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 16 '18 at 14:05









                    rfornalrfornal

                    4,32952235




                    4,32952235























                        0














                        You are getting [objec object] because you are actually trying to set an object in the div, below see the problem line. What you are doing is that you calculate the some and set the result .finalResult div but you are actually assigning the div to a variable and jquery is treating that variable as an object



                        $(document).ready(function(){

                        $('button').click(function(){
                        var oldValue;
                        var getValue;
                        var boxValue;

                        oldValue = $('.box').text();
                        getValue = $('.getValue').val();
                        boxValue = $('.box').text(oldValue + getValue); //<-- problem

                        $('.finalResult').text(boxValue);
                        });
                        });


                        change the following line



                        $('.finalResult').text(boxValue);


                        with this one



                        $('.finalResult').text(boxValue.text());





                        share|improve this answer




























                          0














                          You are getting [objec object] because you are actually trying to set an object in the div, below see the problem line. What you are doing is that you calculate the some and set the result .finalResult div but you are actually assigning the div to a variable and jquery is treating that variable as an object



                          $(document).ready(function(){

                          $('button').click(function(){
                          var oldValue;
                          var getValue;
                          var boxValue;

                          oldValue = $('.box').text();
                          getValue = $('.getValue').val();
                          boxValue = $('.box').text(oldValue + getValue); //<-- problem

                          $('.finalResult').text(boxValue);
                          });
                          });


                          change the following line



                          $('.finalResult').text(boxValue);


                          with this one



                          $('.finalResult').text(boxValue.text());





                          share|improve this answer


























                            0












                            0








                            0







                            You are getting [objec object] because you are actually trying to set an object in the div, below see the problem line. What you are doing is that you calculate the some and set the result .finalResult div but you are actually assigning the div to a variable and jquery is treating that variable as an object



                            $(document).ready(function(){

                            $('button').click(function(){
                            var oldValue;
                            var getValue;
                            var boxValue;

                            oldValue = $('.box').text();
                            getValue = $('.getValue').val();
                            boxValue = $('.box').text(oldValue + getValue); //<-- problem

                            $('.finalResult').text(boxValue);
                            });
                            });


                            change the following line



                            $('.finalResult').text(boxValue);


                            with this one



                            $('.finalResult').text(boxValue.text());





                            share|improve this answer













                            You are getting [objec object] because you are actually trying to set an object in the div, below see the problem line. What you are doing is that you calculate the some and set the result .finalResult div but you are actually assigning the div to a variable and jquery is treating that variable as an object



                            $(document).ready(function(){

                            $('button').click(function(){
                            var oldValue;
                            var getValue;
                            var boxValue;

                            oldValue = $('.box').text();
                            getValue = $('.getValue').val();
                            boxValue = $('.box').text(oldValue + getValue); //<-- problem

                            $('.finalResult').text(boxValue);
                            });
                            });


                            change the following line



                            $('.finalResult').text(boxValue);


                            with this one



                            $('.finalResult').text(boxValue.text());






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Nov 16 '18 at 14:12









                            RopAli MunshiRopAli Munshi

                            702516




                            702516






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Stack Overflow!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53339247%2fhow-can-i-plus-a-integer-value-after-get-sum-result-using-jquery%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Bressuire

                                Vorschmack

                                Quarantine