@ricardorosenblatt put all of this code inside the $w.onReady() : https://www.wix.com/corvid/reference/$w.html#onReady