This is my code which doesn't work:
$(document).ready(function() {
$(document).on('click', '.item', function() {
$(this).width(120);
});
});
.item {
width: 100px;
height: 100px;
border-radius: 10px;
background-color: red;
margin-right: 10px;
display: inline-block;
cursor: pointer;
}
<!DOCTYPE html>
<html>
<head>
<title>jQuery</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<script type="text/javascript" src="script.js"></script>
</body>
</html>
In the browser console it says "$ is not defined" as soon as the page loads. What is the problem?