waitForLoad extracted from setJQuery