I’m trying to declare a variable whose value is another variable that isn’t set at that time.
var add = 1 + three;
var three = 3;
document.getElementById('thediv').innerHTML = add;
//results in "NaN"
Is there a way to do this using Jquery/Javascript?
You could turn add into a function,
http://jsfiddle.net/seSMx/3/
Although, this would be very hard to follow in my opinion. I would take it a step farther and make
threean argument toadd