uncaught typeerror undefined is not a function
While working with Jquery I have tackled with error uncaught typeerror undefined is not a function in google chrome and opera many times so I decided to find out all reasons and solutions behind this error.
Reasons and solutions for uncaught typeerror undefined is not a function error
See uncaught typeerror undefined is not a function shows different in all different browser. if you are using opera and google chrome than it throws uncaught typeerror: undefined is not a function. If you are using Mozilla Firefox than it will show typeerror $(…). is not a function and if you are using Internet explorer than it will throw Expected identifier jquery error but reasons and solutions for all browser are the same.
Let me give your attention that here we are discussing genera Jquery error uncaught typeerror : undefined is not a function. If you have same error in Jquery ui than you can refer my article Uncaught TypeError : Undefined is not a function in Jquery Ui .
There are many reasons behind this error, you can go thorough one by one each and check in your Jquery code.
- Due to more than one time Jquery is added or included
- Due to not proper order of Jquery included (Re arranging Jquery file sequence)
- Due to not properly loaded of Jquery and external plugin
- Due to retired Jquery library or old deprecated Jquery method
- Change $ to Jquery
This is the main reason behind this scenario as our main Jquery is added more than one time. It could be added or included twice or more than twice in our application. We have to also check for our other Jquery plugins like Jquery ui and many more..
Proper order of Jquery is also important as it may cause this issue. First we have to add our Jquery main version than Jquery Ui and than other Jquery plugin version. So keep in mind proper order while including Jquery in your applications or you can say that you have to re arrange Jquery file sequence for proper order.
As we are working with Jquery, it is not sufficient that we added Jquery in our application we also need to check in our browser console and network(also you can use firebug) that all Jquery are properly loaded or not plus same thing we have to check for our external Jquery plugin, if we are using in our application. If you are using external Jquery plugin than also check compatibility of your external plugin with your Jquery main version, whether it is supported or not with current Jquery plugin.
While you are using Jquery in your code and Jquery libraries which you have included are retired and not compatible with your current Jqeury code so this can be a issue. Other issue can be like if you are using latest Jquery version but still you are using old method which is deprecated or removed from latest version than also possibility of error like “uncaught typeerror undefined is not a function”. For example .live method deprecated in Jquery Version 1.7 and it is completely removed in Jquery Version 1.9 and above. .live method is replaced with .on in latest Jquery version.
While working with Jquery, sometimes we have to also check that if we have applied minified version than possibly Jquery error “uncaught typeerror undefined is not a function” can raised. For solutions at least one we need to use full Jquery version instead minified version
If applying above all solutions, you can not solve this issue than one last thing you can do that you have to change $ sign to Jquery. It may solve this problem
What is your opinion ?
Here we have seen all possible reasons and solutions for uncaught typeerror undefined is not a function error in google chrome and opera. I hope it will be very useful to overcome from this Jquery error and you will enjoy it. If you have any query and question, you can comment or you can mail me.