javascript error $ is not defined code example

Example 1: $ is not defined

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>

Example 2: Uncaught ReferenceError: $ is not defined

You should put the references to the jquery scripts first.
<script src="jquery-3.5.1.js"></script>
<script type="text/javascript" src="script.js"></script>

Example 3: $ is not defined

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>

Tags:

Html Example