Reputation: 655
For some reason I can't seem to add a class to my 'li' tag using jQuery, I've done this before but I've been stuck on this for over an hour and can't see what I'm doing wrong!?
Can anyone see a mistake in this? Any help would be greatly appreciated, thanks! :)
<nav>
<ul id="tabs">
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
</ul>
</nav>
<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#tabs li:first').addClass('active');
});
});
</script>
Upvotes: 0
Views: 1068
Reputation: 14827
You have redundant closing brackets:
$(document).ready(function(){
$('#tabs li:first').addClass('active');
}); // <-- Remove this
}); // <-- or this
Upvotes: 2