0

I have linked jQuery and jQuery mobile to my code. I got this error in the console:

TypeError: $.mobile is undefined

I have rechecked the URL and all are correct, I have update the files(jQuery, jQuery mobile) and the issue is still exists. I have place the jquery.js before jquery.mobile.js

This is my code:

    <script src="JS/jquery.js" type="text/javascript"></script>
    <script src="//code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.js"></script>
    <script src="JS/bootstrap.min.js" type="text/javascript"></script>
    <script src="JS/code.js" type="text/javascript"></script>   

and it's on the end of the file. the content of code.js: http://pastebin.com/3LTcxs9S

7
  • Paste the code here, also why double slashes? Commented Jul 5, 2016 at 21:47
  • there u go: pastebin.com/tbHf25Le i tried also this way, it was before with "http://" Commented Jul 5, 2016 at 21:54
  • 3
    @AndrewL. // means use the same protocol as the page. It's commonly used to deal with both http:// and https:// protocols. However, do aware that it won't work in protocols other than those two including file://. Commented Jul 5, 2016 at 22:07
  • Noticed you're using local jQuery and then jQuery Mobile externally (from a CDN), does it work if you try loading jQuery externally as well? Not an answer necessarily, just some troubleshooting. You could try the one from CDNJS: cdnjs.com/libraries/jquery Commented Jul 5, 2016 at 22:37
  • thx guys for your respond but its still dont work, i replaced // with https:// and load both libary from a cdn and its still dont work :( i need only the option to detect the swipeleft/swiperight event. there is another option? Commented Jul 6, 2016 at 11:12

1 Answer 1

1
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"> 
</script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.3.1/jquery.mobile- 
1.3.1.min.js"></script>

try this by replacing your code

NOTE* put jquery mobile script at last after putting all jquery library scripts, im sure it will work

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.