I'm experiencing a kind of specific issue which I'm hoping can be generalized.
I'm trying to use jQuery to alter a div with id="footer-wrapper" that I know exists.
When trying to do this from within a node in Drupal, jQuery can't seem to find the element:
<script type="text/javascript">
alert("div with id=\"page\" has length: " + ($("#page").length));
alert("div with id=\"footer-wrapper\" has length: " + ($("#footer-wrapper").length));
</script>
However it can find the div with id="page", which is also outside the node body. I don't understand why it would be able to find one and not the other.
Here is a rather messy fiddle and here is a link to the actual page.