Man I have looked at literally dozens of what seem to be identical questions...and none of those solutions is working.

My code isn't very complicated--I'm creating a DIV on-the-fly, associating an id with it, giving it a height and then adding the DOM element:

`S = document.createElement('div');
S.setAttribute('id','viewbg');
var pageHeight = getVpHeight();
$('#viewbg').css('height', pageHeight + 'px');
document.getElementsByTagName('body')[0].appendChild(S);`

When I put an alert(pageHeight) after the getVpHeight function call, it has the correct height (full document height, not just window size) but the div ALWAYS defaults to the original css styles defined in the stylesheet, ignoring any new number.

I've tried changing the height after the DOM is created but it does the same thing. I also tried the jQuery (window).resize function and that did nothing.

Am I missing something? Is there a jQuery/CSS wizard who can spot what is going on?