Im trying to sumarise two inputs fields on bind.
THis is my function :
$j('#calclength, #calcwidth').keyup(function() {
var s1 = $j('#calclength').val();
var s2 = $j('#calcwidth').val();
var s3 = (s1) + (s2);
$j('.s1').text(s3);
});
whereas #calclength, #calcwidth are my inputs and .s1 is a span with result.
At the moment whenever ill insert eg 1 & 2 into inputs the result comes out as 12 instead of 3.
Can you guys advice me what I do wrong here please?
Thank you for your help in advance.
Dom
Use unary + operator that converts strings to numbers
Fiddle