Monaca: Where is the jquery after I install it in monaca with onsenui

124 Views Asked by At

In Monaca, I installed JQuery using File | Manage JS/CSS components... Added the JQuery (Monaca version) 2.03 Pressed save, and don't see the JQuery file(s) in my project.

Where are they?

2

There are 2 best solutions below

1
On BEST ANSWER

OK I found it: You have to click the settings thingy in the project, and above the "show hidden files" there is a REFRESH button that you have to hit.

The JQuery-Monaca folder is under components, but you have to explicitly use the src="www/components/monaca-jquery/jquery.js" and that script has to come first, before the loader.js (which uses only src="componenets/loader.js" without the www/.

I don't know why this is so.

1
On

Actually, you don't need to use src="www/components/monaca-jquery/jquery.js" this. All you need is <script src="components/loader.js"></script>.

As you may notice, in the <head> tag in index.html file, there is the following line by default:

<script src="components/loader.js"></script>

This line is required by Monaca in order to include any JavaScript library that you add via JS/CSS Components page (Config --> JS/CSS Components). For example, in your case, you add jQuery (Monaca Version). The jQuery library is included to your project via <script src="components/loader.js"></script>.

All added JS libraries are under www/components/ folder. In this case, you are right; the newly added library is not showing under the folder unless Refresh manually. We are fixing this issue now as well. Thanks for your report. :)

We hope this clarifies how the JS libraries are added and called in Monaca project.