Topic
  • 1 reply
  • Latest Post - ‏2012-08-29T19:46:58Z by SystemAdmin
SystemAdmin
SystemAdmin
2327 Posts

Pinned topic Error loading jquery mobile and jquery tmpl libraries

‏2012-08-29T19:27:35Z |
In my main html file, I'm including jquery.mobile-1.1.1.min.js and jquery.tmpl.min.js from common/js location.
However, when I try to launch the application, I'm seeing these 2 errors in chrome js console.

Uncaught TypeError: Cannot read property 'event' of undefined jquery.mobile-1.1.1.min.js:9
Uncaught ReferenceError: jQuery is not defined jquery.tmpl.min.js:3

After this, the jquery features work fine (via wljq.js) but none of the tmpl features are working (not tried any mobile specific features yet, but I'm guessing they probably won't work either).
I'm thinking maybe these 2 libs don't get loaded at all because of these errors. But I can't figure out why they're throwing these errors.
Here is the html snippet that I'm using to include these 2 libs.

<script src="js/jquery.mobile-1.1.1.min.js"></script>
<script src="js/jquery.tmpl.min.js"></script>
<script src="js/Exercise2App.js"></script>
<script src="js/messages.js"></script>
<script src="js/auth.js"></script>

</body>
</html>

I have verified and reverified that the files are present in the correct location and the filenames are correct in the html file.
If I should put in more information, please let me know and I can provide that.

Any help is greatly appreciated.

Thanks.
Regards,
Dhananjay
  • SystemAdmin
    SystemAdmin
    2327 Posts

    Re: Error loading jquery mobile and jquery tmpl libraries

    ‏2012-08-29T19:46:58Z  
    Jquery mobile relies on jquery, so you'll need to include jquery in your project.

    However, Worklight comes built in with a version of jquery, but it is referenced as "WLJQ". Can you try adding the following lines in the head of your html file to see if it resolves the problem?

    
    <script> window.$ = window.jQuery = WLJQ; </script>