fixed a javascript issue

javascript was loaded before the HTML DOM tree element so issues were
occurring