varX = 2;
varY = 3;
var txt = '#div' + varX+ varY;
alert($(txt).innerHtml);
A couple of things are going on here.
1) If you meant '#div' + varX+ varY; to come out to #div5 then you
have to do '#div' + (varX+ varY); because javascript thinks you are
attempting string concatenation on '#div' +
Hello,
This is because javascript thinks all your variables are strings, because
"#div" is a string.
You can make first your sum, and then concatenate the result
varx = 2;
vary = 3;
varz = x + y;
var txt = "#div" + varz;
hopes this help.
Slts.
- Original Message -
From: Rams j