$(function() { $(".test").click(function(){ var a=$("#l_inpt_1").val(); var b=$("#l_inpt_2").val(); var c=$("#l_inpt_3").val(); var sumS=(a+b+c)/3; $(".midle_g p").append(sumS); }); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input type="text" placeholder="Число 1" id="l_inpt_1"> <input type="text" placeholder="Число 1" id="l_inpt_2"> <input type="text" placeholder="Число 1" id="l_inpt_3"> <button class="test">Очистити поля</button> <div class="midle_g"> <p></p> </div> We have 3 inputs in them, we will enter the numbers 1,2,3 by pressing the button, we must find the average value (1 + 2 + 3) / 3 = 2, but the problem is that the sum displays as 123 and not 6 !How to fix!?