Sunday, August 5, 2012

jQuery

So I changed templates, and that caused jQuery to disappear. Fortunately, adding it again is of course as easy as changing templates was, all I did was load up the template source and add the following line right after the opening tag:

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>

At first I added it right before the closing body tag as I read somewhere that was considered best practice, but that obviously didn't work since the scripts I add in each post are executed before the browser reaches that point. So if I want to be able to put jQuery in my posts, I have to load it somewhere before the element with the id "main", which is where Google puts posts (I think).

Having Google host jQuery makes life so much easier. I only wonder if getting underscore.js will be as simple; because I don't think Google hosts that too.

No comments:

Post a Comment