I've searched the form and can't seem to find a simple solution. I want to add a link to a static JavaScript file that my module will use to the header of the admin section, basically so I can call datepicker since I see jquery-ui is already included in the admin theme.
Is there any easy way to load specific JS files on certain admin tabs?
Add Link to Javascript Files In Admin Head Area Of Template
Re: Add Link to Javascript Files In Admin Head Area Of Templ
I guess putting jquery in the body of the document and using document.ready works. It's not the best practice but it works.
- kidcardboard
- Forum Members
- Posts: 54
- Joined: Mon Sep 28, 2009 5:25 pm
Re: Add Link to Javascript Files In Admin Head Area Of Templ
Put this in your <modulename>.module.php file
Code: Select all
function GetHeaderHTML() {
global $gCms;
$config = $gCms->GetConfig();
return "\r<script type='text/javascript' src='".$config['root_url']."/modules/<modulename>/lib/script.js'></__script>";
}