I have this piece of code, but it has the problem
$ is not defined
This is the code below. I'm trying to adjust the font-weight according to window size
<!DOCTYPE html>
<html>
<head>
<style>
.bold {
font-weight: bold;
}
.normal {
font-weight: normal;
}
</style>
</head>
<body>
<div id="test" class="normal">hiiiii</div>
<script>
$(window).on('resize', function() {
if ($(window).width() > 300) {
$('#test').addClass('normal');
$('#test').removeClass('bold');
} else {
$('#test').addClass('bold');
$('#test').removeClass('normal');
}
})
</script>
</body>
</html>