Uncaught ReferenceError: $ is not defined
at index.html:4
If you see the $ is not defined error in your HTML code, the reason is you have defined the jQuery library import script after using the $ (dollar function), make sure you add <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script> before you use jQuery function,
Below Example will through console error,
<html>
<head>
<script>
$(document).ready(function () {
console.log("hello this is some code!");
});
</script>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
</head>
<body>
<H1>$ is not defined</H1>
</body>
</html>
Error: Uncaught ReferenceError $ is not define
Code After fixing the issue:
<html>
<head>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script>
$(document).ready(function () {
console.log("hello this is some code!");
});
</script>
</head>
<body>
<H1>$ is not defined error fixed! </H1>
</body>
</html>
Have Questions? Post them here!
More Posts related to jQuery,
- How to check if an element is hidden using jQuery code?
- Disable jQuery button after being click
- Make div element draggable using jQuery
- Get Browser Screen Width and Height dynamically using jQuery
- jQuery : Move to top of the page
- [jQuery] Uncaught ReferenceError: $ is not defined at index.html:5
- Redirect page using jQuery
More Posts:
- Python: Traverse List Backwards - Python
- How to Restart Mac using Terminal Command - MacOS
- 5 Ways to Loop a Dictionary in Python - Python
- Java: Convert Stream to List - Java
- Change the background of Tkinter label or text - Python
- How to get file path in Idea IntelliJ IDE - Java
- Jupyter Notebook add Table Of Contents (TOC) - Python
- List of PowerShell Cmdlet Commands for Mac - Powershell