Problem defining the height of an element using JavaScript

guru123

New Member
I'm trying to run the following code on a website to set up the height of elements in a webpage:\[code\]document.querySelector("#body").style.height = window.innerHeight - document.querySelector("#footer").offsetHeight;\[/code\]It's part of a function, and all the other parts of the function appear to be working properly, but this section does not work.A similar command however, written with jQuery, does work:\[code\]$("#body").css({ "height" : window.innerHeight - document.querySelector("#footer").offsetHeight });\[/code\]But I'd rather not have to call on the jQuery library for something as small as this.Any suggestions as for what I'm doing wrong?
 
Top