In the project, encountered the above two errors, repeated toss for a long time, JS code write no problem, jquery file also introduced, is repeatedly reported errors, XXX is not a function.
This is the error, shake is not a function, I am also a dog, shake is clearly I in other JS files, the expansion of the method of jquery, how not function, handy hyperlink: jquery to achieve jitter effect
And then I found this post: $ is not defined error
Found in the comment area, answer the question:
Is the introduction of JS file order reversed, resulting in the above error, such as the following code:
<script src="~/scripts/javascript1.js"></script> <script src=" ~/scripts/jquery-1.7.1.js"></script>
When applied to jquery in the Javascript1.js file, it cannot be referenced before jquery, otherwise the above error occurs when calling methods in JavaScript1. You can adjust the order.
jquery in XXX is not a function or can not find $