JavaScript/jQuery – “$ is not defined- $function()” error

You must not have made jQuery available to your script.

Add this to the top of your file:

<script type="text/javascript" src="https://code.jquery.com/jquery-1.7.1.min.js"></script>

This issue is related to the jQuery/JavaScript file not added to the PHP/JSP/ASP file properly. This goes out and gets the jQuery code from the source. You could download that and reference it locally on the server which would be faster.

Or either one can directly link it to jQuery or GoogleCDN or MicrosoftCDN.

How do add jQuery to your webpage

Leave a Comment