1👍
$
is a common shortcut for jQuery. You’re using it on line 3 to select the element with the id of "image".
var $image = $('#image');
Your (first) error is saying $
is not defined, which means you didn’t load jQuery. Make sure you load jQuery by including it using a script tag in your HTML somewhere.
Something like:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
Then you should be able to run your first code with no problem!
Source:stackexchange.com