I am authoring a WP plugin, and I have to generate some JS (jQuery) code in "realtime". It is working fine in general, though I've stuck with one problem with the WP 3.5.1 and its default Twenty Twelve theme: there the scripts are inserted in the footer of the page, not in the header, causing my code to throw errors.
I've looked through all the theme's files (header, footer, functions), and I can't seem to find the reason for that. Looks like the
wp_footer() is inserting the block, but I can't find any hook or anything else that tells WordPress to insert scripts there.
So, my question is: how to make jQuery and other scripts go in the header by default, not in the footer? What does make the theme work this way (maybe the default WP behavior changed?)