×
We value your feedback! Please click here to access our 2024 Client Survey.
The survey will remain open until November 1st. Your perspective will help guide our product/service planning and goals for the upcoming year and beyond!

What exactly does it take to have jQuery enabled/working within my custom Labkey module?

LabKey Support Forum
What exactly does it take to have jQuery enabled/working within my custom Labkey module? Nick Kerr  2012-05-22 18:58
Status: Closed
 
Hi Leo,

We provide an JavaScript API for requesting additional scripts. Here is an example:

<a href="#" class="usejquery">See JQuery Run</a>
<script type="text/javascript">

    var jQueryReady = function() {

        /* Use JQuery */
        $('a.usejquery').click(function(event){
            alert('JQuery allowed this to happen.');
        });

    }

    /* Request the scripts -- you do not need to provide the Context Path */
    LABKEY.requiresScript([
        '<your module>/jQuery/development-bundle/ui/jquery.ui.core.js',
        '<your module>/jQuery/development-bundle/ui/jquery.ui.widget.js'
        // add more files to this array
    ], true, jQueryReady, this, true);

</script>

See our JavaScript documentation for more information.

Thanks,
Nick