I originally thought I should always include js which shouldn't be parsed until the html had been written using the following:
$(document).ready(function () { //My code });
I later read that I shouldn't do this (JQuery Cookbook, or something similar) but instead should just include my JS at the very end of the page but before the body close tag.