Hi,
I'm have some issues adding a class to 2 navigation links on a theme.
I need to add a class based on a url string as i'm redirecting the page to another.
You can see the blog here: http://208.43.250.67/~thingsig/
Links are: 'Blog' and 'Keepers'
I'm using the following code:
<script type="text/javascript">
if (window.location.pathname.indexOf('/category/blog/')){
if ( $('#nav ul li a span').text().contains('BLOG') ){
//add class 'current_page_item' to:
$('#nav ul li').addClass('current_page_item');
}
}
if (window.location.pathname.indexOf('/category/keepers/')){
if ( $('#nav ul li a span').text().contains('KEEPERS') ){
//add class 'current_page_item' to:
$('#nav ul li').addClass('current_page_item');
}
}
</script>
Can anyone see why that doesnt work?
I get the following error: $ is not a function [Break on this error] if ( $('#nav ul li a span').text().contains('BLOG') ){