I am trying to get the offset value of a class in a variable. When I print the value of the variable like directly it shows the value. But when I add .top to that varialble it shows that the variable is undefined.
Heres the example
var elementHeight = $(".rickshaw_graph .detail .item");
var offset = elementHeight.offset();
console.log(offset)
When I check the console it shows
({top:735.9499969482422, left:402.70001220703125})
But when I add top to the above code
var elementHeight = $(".rickshaw_graph .detail .item");
var offset = elementHeight.offset();
console.log(offset.top)
It shows that the offset variable is undefined. What should I do here?