In the given scenario, how would I assign a DOM object to a variable and call to it? In this example I am trying to get “nav” elements height. Right now it is not returning any values and I am thinking it is because the element is called before the document is ready.
$(document).ready( function(){
gbe.init();
});
var gbe = {
navigation : $("nav"),
init : function() {
gbe.nav.init();
},
nav : {
init : function() {
navHeight : gbe.navigation.height();
console.log(gbe.nav.init.navHeight, gbe.navigation.height());
}
}
};
What if you did this: