<html>
<head>
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"></script>
<style>
.emphasis { font-weight: bold; }
</style>
<script>
$(function() {
$('li:first-child').addClass('emphasis');
});
</script>
</head>
<body>
<ul>
<li>hello</li>
<li>hello2</li>
<li>hello3</li>
</ul>
</body>
</html>
I’m following a tutorial: http://tutsplus.com/lesson/not-so-fast-jquery/
This code is exactly what he has near the end, yet it does not work for me. Any reason why?
The code works fine. Try clearing your browsers cache or try it in a different browser.