How to solve $ is not a function jquery error from browser console?
This is one of the most common and irritating Jquery error a developer gets in his/her daily work routine.
Today I am going to cover some steps to overcome these kind of situations.One thing I want to tell that ,To get the solution of any kind of problem,always try to figure out the root cause of the that problem. There are 2 possible reason behind "$ is not a function jquery error" :
1. Jquery core library is not included. (e,g jquery.1.9.4.min.js ) it may be any version
2. There might be Jquery conflicts between two or more Jquery Library included in same Html page.
Solution of first reason is very straight forward, what you need to do is, just adding a Jquery library reference to your html page. (make sure that you are adding reference before the code that uses the jquery library)
To solve the second reason you need to either add Jquery conflicts as i told in my other blog post (https://codibucket.blogspot.in/2016/08/what-is-difference-between-prop-and.html).
In ‘no conflict’ mode the $shortcut is disabled, so you must replace it with the word ‘jQuery’ (notice the capitalized Q).
So if you had a piece of script such as:
1
2
3
4
5
| $(document).ready( function () { $( ".someClass" ).hide(); $( "#elementID .anotherClass" ).eq(2).show(); ... } |
You’d replace all the dollar symbols with the string ‘jQuery’.
1
2
3
4
5
| jQuery(document).ready( function () { jQuery( ".anyClass" ).hide(); jQuery( "#ID_OF_Element.ClassName" ).show(); ... |
This is not the final solution. If you still get and issue with same error you have to create a Jquery.noConflits() variables and using into your code as i mentioned in my other post.
Hope you link the solution.Please provide your feedback so i can improve accordingly.
Thanks.
How to solve $ is not a function jquery error from browser console?
Reviewed by CodiBucket
on
10:31
Rating:
No comments: