Reputation: 18067
I'm trying to reuse parts of some JQuery code I've used before for another website, but for some reason, this use of it is causing the whole page to be blank. When I comment the JQuery code out, it displays as intended. The code is below (this is inside my <head>
element):
<head>
<!-- Jquery Stuff -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<!-- <script src="js/jquery-1.3.2.min.js"></script> --> <!--For when DNS is down! :D -->
<script type="text/javascript">
jQuery.noConflict();
(function($) {
$(function() {
/* hacky nav highlighting */
var loc = window.location.href;
//strip the existing current state
$('#nav .current').removeClass('current');
//add class to current section...
//About
if(loc.indexOf('about.html') > -1){
$('#nav #about').addClass('current');
}
//Pictars
else if(loc.indexOf('pictures') > -1){
$('#nav #pictures').addClass('current');
}
//Forums
else if(loc.indexOf('forums') > -1){
$('#nav #forums').addClass('forums');
}
//Archives
else if (loc.indexOf('archives') > -1) {
$('#nav #archives').addClass('current');
}
//Submit Content
else if (loc.indexOf('submit') > -1) {
$('#nav #submit').addClass('current');
}
//Feedback
else if (loc.indexOf('feedback') > -1) {
$('#nav #feedback').addClass('current');
}
);
});
})(jQuery);
</head>
What do you think is happening? Are there any glaring errors in my code? I'm quite new to JQuery, so I'm very confused. Thanks!
Upvotes: 0
Views: 132
Reputation: 17528
You need a closing script tag before the closing head tag.
</script>
</head>
Upvotes: 2