Hook a script as the very last one before the closing body tag

Assuming these are scripts enqueued via wp_enqueue_script(), the absolute best solution would be to locate the registration/enqueuement of the script creating the element and simply specify it’s handle as a dependency for your script. WordPress will then ensure that yours loads after that dependency. There are other work-arounds to ensure that your script is the … Read more