What is the right way to include jquery.min.js and jquery-ui.min.js in a UI Page and UI Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2016 09:02 AM
As mentioned in the title I am trying to add jquery to my UI Page.
I was able to add jquery.min.js to the UI Page with a <script>https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> tag, but I cannot call any jquery in UI Scripts linked to this UI Page, I get errors like "$ is not a function". (Could it be and issue with the namespace since I'm in a scoped application?).
Also I cannot load the User Interface jquery-ui.min.js in either the UI Page or the UI Script. I have tried loading it with a <script> tag at the top of the UI Page and by putting the <script> tag in a UI Macro and then doing a <g:macro_invoke> in the UI Page, but neither version worked.
Any help would be appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2016 01:39 PM
I was able to load both jquery and jquery-ui by putting the whole library in a UI script.
From there then just did a <g:requires> on the UI page to add each one. While this works great I am still unable to use either one in a separate UI Script under the same scope

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2017 12:43 PM
Hi,
There is a similar question about loading JQuery answered here: How to use - JQuery in UI Page? by Abhiram B Diddigi
Essentially, you do not need to load JQuery because it is loaded automatically.
Instead you just need to use $j rather than simply the $.
For example
The selector $("[id=my-Address]")
Becomes $j("[id=my-Address]")
Thanks,
Cody