make sure script is run after div element is loaded