Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

cPanel 54 + jQuery

Discussion in 'User Experience' started by Dev@SH, Jan 26, 2016.

  1. Dev@SH

    Dev@SH Member

    Joined:
    Mar 11, 2014
    Messages:
    17
    Likes Received:
    1
    Trophy Points:
    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.
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,442
    Likes Received:
    1,961
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Dev@SH

    Dev@SH Member

    Joined:
    Mar 11, 2014
    Messages:
    17
    Likes Received:
    1
    Trophy Points:
    3
    cPanel Access Level:
    DataCenter Provider
    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.
     
  4. cPanelAdamF

    cPanelAdamF cPanel Product Owner
    Staff Member

    Joined:
    Mar 21, 2013
    Messages:
    241
    Likes Received:
    55
    Trophy Points:
    103
    Location:
    Houston TX
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    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!
     
  5. Dev@SH

    Dev@SH Member

    Joined:
    Mar 11, 2014
    Messages:
    17
    Likes Received:
    1
    Trophy Points:
    3
    cPanel Access Level:
    DataCenter Provider
    [​IMG]
    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
     
    #5 Dev@SH, Feb 4, 2016
    Last edited: Feb 4, 2016
  6. cPanelAdamF

    cPanelAdamF cPanel Product Owner
    Staff Member

    Joined:
    Mar 21, 2013
    Messages:
    241
    Likes Received:
    55
    Trophy Points:
    103
    Location:
    Houston TX
    cPanel Access Level:
    DataCenter Provider
    Twitter:
  7. Dev@SH

    Dev@SH Member

    Joined:
    Mar 11, 2014
    Messages:
    17
    Likes Received:
    1
    Trophy Points:
    3
    cPanel Access Level:
    DataCenter Provider
    Thank you for the updates. We appreciate them.
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice