Mar 11, 2014
17
1
3
cPanel Access Level
DataCenter Provider
Guide to cPanel Interface Customization - Software Development Kit - cPanel Documentation

On that page, the documentation says
"In cPanel & WHM version 54 and later, if your custom interfaces require jQuery, you must include that code in a define() block"

I'm not a complete noob ... but... What?

Can you give me a working example of adding jQuery to a global_header.html.tt file.

I would assume that this has to be in a template-toolkit block of sorts however I can't find any information that states this.

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Hello :)

Does your custom interface require jQuery? If not, you can safely ignore that warning. Otherwise, could you provide more details about what you are implementing so we can offer an example?

Thank you.
 

cPanelAdamF

cPanel Product Owner
Staff member
Mar 21, 2013
297
136
168
Houston TX
cPanel Access Level
DataCenter Provider
Twitter
I took out the jQuery out for now but I would still like to see how to include jQuery code in a .tt file. Thank you.
Our documentation team just published Guide to cPanel Interface Customization - jQuery - Software Development Kit - cPanel Documentation which goes much more in depth about the changes, including examples from both a JS perspective and a .tt file perspective. Please have a look - Very open to feedback about how we can make this document better!
 
Mar 11, 2014
17
1
3
cPanel Access Level
DataCenter Provider
This is the error that I'm getting.
HTML:
<script>
    define(
        [
            "jquery"
        ],
        function($) {
            // Code that uses jQuery goes here.
            $(document).ready(function() {
                 console.log("Loaded");
            });
        });
</script>
Placing that in the global_header.html.tt file to be used with my custom style.

whm / cpanel 54.0.12
 
Last edited by a moderator: