[4.1.1] Run jQuery in a portlet.

4 views
Skip to first unread message

Nathan Keiter

unread,
Dec 6, 2017, 10:20:22 AM12/6/17
to dot...@googlegroups.com
I am trying to get a very simple page to render. Even though all the resources are loaded, jQuery and jQuery UI are yet undefined.


Has anyone been able to create a portlet in 4.1.x or greater than runs jQuery as a loaded resource?


Is there some kind of non-standard trick to get this to work?


Source:

Screen Shot 2017-12-06 at 10.02.28 AM.png
[cid:a9b2f6a2-1b41-4bf8-b07c-3c12c67408e3]


Error:

[cid:6b0a0b81-77c2-4d50-b4a9-504bf692348e]


Nathan I. Keiter | Lead Network Applications Programmer | Benefits Advisory Council Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993
https://www.gettysburg.edu

Jason Tesser

unread,
Dec 6, 2017, 11:01:15 AM12/6/17
to dot...@googlegroups.com
I think in this case you would need to load JQuery into the HEAD of the HTML right?

You could try something like 

(function () {
    var ele = document.createElement('script');
    ele.id = "JQuery";
    ele.onload = function () {
        //code to be executed when the document has been loaded
    };
    document.getElementsByTagName('head')[0].appendChild(ele);
})();

THEN add for the other JS imports as well 

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To post to this group, send email to dot...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/1512573613605.28330%40gettysburg.edu.
For more options, visit https://groups.google.com/d/optout.

Nathan Keiter

unread,
Dec 6, 2017, 11:41:13 AM12/6/17
to dot...@googlegroups.com

Hmm, ok, I’ll try that.

 

Nathan I. Keiter | Lead Network Applications Programmer | Benefits Advisory Council Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993

https://www.gettysburg.edu

 

Reply all
Reply to author
Forward
0 new messages