How to add 2 variables in Javascript [closed]
I want to add two variable开发者_StackOverflow社区s which have numeric values using javascript.
var seconds = 1100;
var time = 300;
var newV = seconds + time;
$('.show').html(newV);
But it is saying undefined
thanx
http://jsfiddle.net/n9NcY/
This HTML is probably what you were missing
<div class="show"> </div>
your code
$(document).ready(function() {
var seconds = 1100;
var time = 300;
var newV = seconds + time;
$('.show').html(newV);
});
精彩评论