$.mobile is undefined Error

If you are here, then you are facing this problem right now. I hope I can help you with the issue.

Actually, the reason is quite obvious and the solution should be as easy. This message says “you are developing a JQM (jQueryMobile) application but have not referenced the javascript file that is needed!”.

What you need to do is add the jQueryMobile reference to your application, it should be a line like below:

<script type=”text/javascript” src=”http://ajax.aspnetcdn.com/ajax/jquery.mobile/1.2.0/jquery.mobile-1.2.0.min.js“>
</script>

Note: You can find Microsoft Ajax Content Delivery Network (CDN) here.

If you have your reference in place but you are still getting this error message;

a) Check the protocol on the reference of jQueryMobile javascript file, is it http or https? If it is https, change it to http.

b) CDN might be temporarily unavailable, try with a local copy of the .js file.

If you are using a local copy of .js file and getting this error then check the .js file for any syntax errors. Have you changed anything in the file?

Hope this helps someone.

Good luck,
Serdar.

Leave a Reply

Your email address will not be published. Required fields are marked *