Finally got it Working!

changed HTML so that my JS runs on the click of a button