Based on the jQuery Mobile docs, the <script> tags to load jQuery and jQuery mobile should go inside the <head> element.
I’ve always been told to load <script> tags at the bottom of the page for better performance. For example: http://developer.yahoo.com/blogs/ydn/posts/2007/07/high_performanc_5/
Is there a reason to prefer one location over the other for jQuery Mobile scripts?
Putting the
<script>at the bottom is to facilitate faster loading of external elements before code executes, but in jQM nothing will really show until the pageinit/pageshow events fire, which is basically jQM’s version of document.ready (everything is loaded and the DOM is there etc)I can imagine in larger sites where you want content to be displayed ASAP this would come in handy, kind of like attaching passive
onlisteners even before the document.ready is another trick people use.But all these speed optimizations don’t mean much when you’re waiting for a
document.readyto display anything.