REALLY basic stuff here. Pretty new to jQuery. I'm trying to add two values (these happen to be the total height of two sidebars. I use alert for each and receive the correct height. But, when I try to add these together, I get the [object Object] return.

To make this utterly basic, which is where I am, what am I not doing? It seems logical enough but doesn't work.

var sbheight1 = jQuery(".sidebar1").height();
var sbheight2 = jQuery(".sidebar2").height();
var sbtotal = jQuery (sbheight1 + sbheight2);
alert (sbtotal);

Help appreciated. Keep it simple for this humble beginner.
Thanks.

Recommended Answers

All 2 Replies

have you tried :

3. var sbtotal = sbheight1 + sbheight2;
4. alert (sbtotal);

Egods, Troy, to paraphrase, Syntax, Syntax, Syntax! Yeah, that worked. I've been looking for a couple days, trying all kinds of exotic solutions. It's this simple. Thank you VERY much.

Mike

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.