I want to tidy my header.php file up a bit and so I'm creating a custom.js file to add all of the lose javascript etc. The problem is when it's in the header it works okay but if I then add it to an external file and link to that from the header it doesn't work?
For example I'm using
<script type="text/javascript" src="<?php bloginfo( 'template_directory' ); ?>/scripts/custom.js"></script>
to call the javascript and it's linking correctly but the code isn't working. An example of the code not working:
jQuery(document).ready( function($) {
$('#access > li:last-child').addClass('last-item');
} );
I've tried moving the location of the link around the head tags but nothing!
Any help would be very much appreciated.